code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def _restart_required_dialog(self): """Displays the dialog informing user a restart is required.""" QMessageBox.information( self, trans._('Restart required'), trans._( 'A restart is required for some new settings to have an effect.' ), ...
Displays the dialog informing user a restart is required.
_restart_required_dialog
python
napari/napari
src/napari/_qt/dialogs/preferences_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/preferences_dialog.py
BSD-3-Clause
def reject(self): """Restores the settings in place when dialog was launched.""" self._settings.update(self._starting_values) # FIXME: this dialog should not need to know about the plugin manager if self._starting_pm_order: from napari.plugins import plugin_manager ...
Restores the settings in place when dialog was launched.
reject
python
napari/napari
src/napari/_qt/dialogs/preferences_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/preferences_dialog.py
BSD-3-Clause
def showAbout(parent=None): """Display the 'About napari' dialog box. Parameters ---------- parent : QWidget, optional Parent of the dialog, to correctly inherit and apply theme. Default is None. """ d = QtAbout(parent) d.setObjectName('Qt...
Display the 'About napari' dialog box. Parameters ---------- parent : QWidget, optional Parent of the dialog, to correctly inherit and apply theme. Default is None.
showAbout
python
napari/napari
src/napari/_qt/dialogs/qt_about.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_about.py
BSD-3-Clause
def handle_progress_change(self, event): """Handle addition and/or removal of new progress objects Parameters ---------- event : Event EventedSet `changed` event with `added` and `removed` objects """ for prog in event.removed: self.close_progress...
Handle addition and/or removal of new progress objects Parameters ---------- event : Event EventedSet `changed` event with `added` and `removed` objects
handle_progress_change
python
napari/napari
src/napari/_qt/dialogs/qt_activity_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_activity_dialog.py
BSD-3-Clause
def make_new_pbar(self, prog): """Make new `QtLabeledProgressBar` for this `progress` object and add to viewer. Parameters ---------- prog : progress progress object to associated with new progress bar """ prog.gui = True prog.leave = False #...
Make new `QtLabeledProgressBar` for this `progress` object and add to viewer. Parameters ---------- prog : progress progress object to associated with new progress bar
make_new_pbar
python
napari/napari
src/napari/_qt/dialogs/qt_activity_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_activity_dialog.py
BSD-3-Clause
def add_progress_bar(self, pbar, nest_under=None): """Add progress bar to activity_dialog,in QtProgressBarGroup if needed. Check if pbar needs nesting and create QtProgressBarGroup, removing existing separators and creating new ones. Show and start inProgressIndicator to highlight the e...
Add progress bar to activity_dialog,in QtProgressBarGroup if needed. Check if pbar needs nesting and create QtProgressBarGroup, removing existing separators and creating new ones. Show and start inProgressIndicator to highlight the existence of a progress bar in the dock even when the d...
add_progress_bar
python
napari/napari
src/napari/_qt/dialogs/qt_activity_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_activity_dialog.py
BSD-3-Clause
def get_pbar_from_prog(self, prog): """Given prog `progress` object, find associated `QtLabeledProgressBar` Parameters ---------- prog : progress progress object with associated progress bar Returns ------- QtLabeledProgressBar QtLabeledP...
Given prog `progress` object, find associated `QtLabeledProgressBar` Parameters ---------- prog : progress progress object with associated progress bar Returns ------- QtLabeledProgressBar QtLabeledProgressBar widget associated with this progress...
get_pbar_from_prog
python
napari/napari
src/napari/_qt/dialogs/qt_activity_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_activity_dialog.py
BSD-3-Clause
def close_progress_bar(self, prog): """Close `QtLabeledProgressBar` and parent `QtProgressBarGroup` if needed Parameters ---------- prog : progress progress object whose QtLabeledProgressBar to close """ current_pbar = self.get_pbar_from_prog(prog) if...
Close `QtLabeledProgressBar` and parent `QtProgressBarGroup` if needed Parameters ---------- prog : progress progress object whose QtLabeledProgressBar to close
close_progress_bar
python
napari/napari
src/napari/_qt/dialogs/qt_activity_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_activity_dialog.py
BSD-3-Clause
def move_to_bottom_right(self, offset=(8, 8)): """Position widget at the bottom right edge of the parent.""" if not self.parent(): return sz = self.parent().size() - self.size() - QSize(*offset) self.move(QPoint(sz.width(), sz.height()))
Position widget at the bottom right edge of the parent.
move_to_bottom_right
python
napari/napari
src/napari/_qt/dialogs/qt_activity_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_activity_dialog.py
BSD-3-Clause
def maybe_hide_progress_indicator(self): """Hide progress indicator when all progress bars have finished.""" pbars = self._baseWidget.findChildren(QtLabeledProgressBar) pbar_groups = self._baseWidget.findChildren(QtProgressBarGroup) progress_visible = any(pbar.isVisible() for pbar in pb...
Hide progress indicator when all progress bars have finished.
maybe_hide_progress_indicator
python
napari/napari
src/napari/_qt/dialogs/qt_activity_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_activity_dialog.py
BSD-3-Clause
def remove_separators(current_pbars): """Remove any existing line separators from current_pbars as they will get a separator from the group Parameters ---------- current_pbars : List[QtLabeledProgressBar] parent and new progress bar to remove separators from """ for current_pbar in ...
Remove any existing line separators from current_pbars as they will get a separator from the group Parameters ---------- current_pbars : List[QtLabeledProgressBar] parent and new progress bar to remove separators from
remove_separators
python
napari/napari
src/napari/_qt/dialogs/qt_activity_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_activity_dialog.py
BSD-3-Clause
def show_above_mouse(self, *args): """Show popup dialog above the mouse cursor position.""" pos = QCursor().pos() # mouse position szhint = self.sizeHint() pos -= QPoint(szhint.width() // 2, szhint.height() + 14) self.move(pos) self.show()
Show popup dialog above the mouse cursor position.
show_above_mouse
python
napari/napari
src/napari/_qt/dialogs/qt_modal.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_modal.py
BSD-3-Clause
def keyPressEvent(self, event): """Close window on return, else pass event through to super class. Parameters ---------- event : qtpy.QtCore.QEvent Event from the Qt context. """ if event.key() in (Qt.Key.Key_Return, Qt.Key.Key_Enter): self.close(...
Close window on return, else pass event through to super class. Parameters ---------- event : qtpy.QtCore.QEvent Event from the Qt context.
keyPressEvent
python
napari/napari
src/napari/_qt/dialogs/qt_modal.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_modal.py
BSD-3-Clause
def _update_icon(self, severity: str): """Update the icon to match the severity level.""" from napari.settings import get_settings from napari.utils.theme import get_theme settings = get_settings() theme = settings.appearance.theme default_color = get_theme(theme).icon.a...
Update the icon to match the severity level.
_update_icon
python
napari/napari
src/napari/_qt/dialogs/qt_notification.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_notification.py
BSD-3-Clause
def slide_in(self): """Run animation that fades in the dialog with a slight slide up.""" geom = self.geometry() self.geom_anim.setDuration(self.FADE_IN_RATE) self.geom_anim.setStartValue(geom.translated(0, 20)) self.geom_anim.setEndValue(geom) self.geom_anim.setEasingCurv...
Run animation that fades in the dialog with a slight slide up.
slide_in
python
napari/napari
src/napari/_qt/dialogs/qt_notification.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_notification.py
BSD-3-Clause
def show(self): """Show the message with a fade and slight slide in from the bottom.""" super().show() self.slide_in() if self.parent() is not None and not self.parent().isActiveWindow(): return if self.parent() is not None: notifications = cast( ...
Show the message with a fade and slight slide in from the bottom.
show
python
napari/napari
src/napari/_qt/dialogs/qt_notification.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_notification.py
BSD-3-Clause
def deleteLater(self) -> None: """stop all animations and timers before deleting""" self.opacity_anim.stop() self.geom_anim.stop() self.timer.stop() super().deleteLater()
stop all animations and timers before deleting
deleteLater
python
napari/napari
src/napari/_qt/dialogs/qt_notification.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_notification.py
BSD-3-Clause
def expand(self): """Expanded the notification so that the full message is visible.""" curr = self.geometry() self.geom_anim.setDuration(100) self.geom_anim.setStartValue(curr) new_height = self.sizeHint().height() if new_height < curr.height(): # new height w...
Expanded the notification so that the full message is visible.
expand
python
napari/napari
src/napari/_qt/dialogs/qt_notification.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_notification.py
BSD-3-Clause
def contract(self): """Contract notification to a single elided line of the message.""" geom = self.geometry() self.geom_anim.setDuration(100) self.geom_anim.setStartValue(geom) dlt = geom.height() - self.minimumHeight() self.geom_anim.setEndValue( QRect(geom....
Contract notification to a single elided line of the message.
contract
python
napari/napari
src/napari/_qt/dialogs/qt_notification.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_notification.py
BSD-3-Clause
def setupUi(self): """Set up the UI during initialization.""" self.setWindowFlags(Qt.WindowType.SubWindow) self.setMinimumWidth(self.MIN_WIDTH) self.setMaximumWidth(self.MIN_WIDTH) self.setMinimumHeight(40) self.setSizeGripEnabled(False) self.setModal(False) ...
Set up the UI during initialization.
setupUi
python
napari/napari
src/napari/_qt/dialogs/qt_notification.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_notification.py
BSD-3-Clause
def setup_buttons(self, actions: ActionSequence = ()): """Add buttons to the dialog. Parameters ---------- actions : tuple, optional A sequence of 2-tuples, where each tuple is a string and a callable. Each tuple will be used to create button in the dialog, ...
Add buttons to the dialog. Parameters ---------- actions : tuple, optional A sequence of 2-tuples, where each tuple is a string and a callable. Each tuple will be used to create button in the dialog, where the text on the button is determine by the first item...
setup_buttons
python
napari/napari
src/napari/_qt/dialogs/qt_notification.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_notification.py
BSD-3-Clause
def call_back_with_self(callback_, self): """ We need a higher order function this to capture the reference to self. """ def _inner(): return callback_(self) return _inner
We need a higher order function this to capture the reference to self.
call_back_with_self
python
napari/napari
src/napari/_qt/dialogs/qt_notification.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_notification.py
BSD-3-Clause
def sizeHint(self): """Return the size required to show the entire message.""" return QSize( super().sizeHint().width(), self.row2_widget.height() + self.message.sizeHint().height(), )
Return the size required to show the entire message.
sizeHint
python
napari/napari
src/napari/_qt/dialogs/qt_notification.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_notification.py
BSD-3-Clause
def set_plugin(self, plugin: str) -> None: """Set the current plugin shown in the dropdown and text area. Parameters ---------- plugin : str name of a plugin that has created an error this session. """ self.github_button.hide() self.clipboard_button.h...
Set the current plugin shown in the dropdown and text area. Parameters ---------- plugin : str name of a plugin that has created an error this session.
set_plugin
python
napari/napari
src/napari/_qt/dialogs/qt_plugin_report.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_plugin_report.py
BSD-3-Clause
def copyToClipboard(self) -> None: """Copy current plugin traceback info to clipboard as plain text.""" plugin = self.plugin_combo.currentText() err_string = format_exceptions(plugin, as_html=False) cb = QGuiApplication.clipboard() cb.setText(err_string)
Copy current plugin traceback info to clipboard as plain text.
copyToClipboard
python
napari/napari
src/napari/_qt/dialogs/qt_plugin_report.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_plugin_report.py
BSD-3-Clause
def setup_ui(self, error_message, readers, persist_checked): """Build UI using given error_messsage and readers dict""" # add instruction label layout = QVBoxLayout() if error_message: error_message += '\n' label = QLabel( f'{error_message}Choose reader f...
Build UI using given error_messsage and readers dict
setup_ui
python
napari/napari
src/napari/_qt/dialogs/qt_reader_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_reader_dialog.py
BSD-3-Clause
def add_reader_buttons(self, layout, readers): """Add radio button to layout for each reader in readers""" for display_name in sorted(readers.values()): button = QRadioButton(f'{display_name}') self.reader_btn_group.addButton(button) layout.addWidget(button)
Add radio button to layout for each reader in readers
add_reader_buttons
python
napari/napari
src/napari/_qt/dialogs/qt_reader_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_reader_dialog.py
BSD-3-Clause
def _get_plugin_choice(self): """Get user's plugin choice based on the checked button""" checked_btn = self.reader_btn_group.checkedButton() if checked_btn: return checked_btn.text() return None
Get user's plugin choice based on the checked button
_get_plugin_choice
python
napari/napari
src/napari/_qt/dialogs/qt_reader_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_reader_dialog.py
BSD-3-Clause
def get_user_choices(self) -> tuple[str, bool]: """Execute dialog and get user choices""" display_name = '' persist_choice = False dialog_result = self.exec_() # user pressed cancel if dialog_result: # grab the selected radio button text display_n...
Execute dialog and get user choices
get_user_choices
python
napari/napari
src/napari/_qt/dialogs/qt_reader_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_reader_dialog.py
BSD-3-Clause
def handle_gui_reading( paths: list[str], qt_viewer, stack: bool | list[list[str]], plugin_name: str | None = None, error: ReaderPluginError | None = None, plugin_override: bool = False, **kwargs, ): """Present reader dialog to choose reader and open paths based on result. This func...
Present reader dialog to choose reader and open paths based on result. This function is called whenever ViewerModel._open_or_get_error returns an error from a GUI interaction e.g. dragging & dropping a file or using the File -> Open dialogs. It prepares remaining readers and error message for display, ...
handle_gui_reading
python
napari/napari
src/napari/_qt/dialogs/qt_reader_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_reader_dialog.py
BSD-3-Clause
def prepare_remaining_readers( paths: list[str], plugin_name: str | None = None, error: ReaderPluginError | None = None, ): """Remove tried plugin from readers and raise error if no readers remain. Parameters ---------- paths : List[str] paths to open plugin_name : str | None ...
Remove tried plugin from readers and raise error if no readers remain. Parameters ---------- paths : List[str] paths to open plugin_name : str | None name of plugin previously tried, if any error : ReaderPluginError | None previous error raised in the process of opening ...
prepare_remaining_readers
python
napari/napari
src/napari/_qt/dialogs/qt_reader_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_reader_dialog.py
BSD-3-Clause
def open_with_dialog_choices( display_name: str, persist: bool, extension: str, readers: dict[str, str], paths: list[str], stack: bool, qt_viewer, **kwargs, ): """Open paths with chosen plugin from reader dialog, persisting if chosen. Parameters ---------- display_name :...
Open paths with chosen plugin from reader dialog, persisting if chosen. Parameters ---------- display_name : str display name of plugin to use persist : bool True if user chose to persist plugin association, otherwise False extension : str file extension for association of p...
open_with_dialog_choices
python
napari/napari
src/napari/_qt/dialogs/qt_reader_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/qt_reader_dialog.py
BSD-3-Clause
def qt_viewer_has_pbar(qt_viewer): """Returns True if the viewer has an active progress bar, else False""" return bool( qt_viewer.window._qt_viewer.window()._activity_dialog.findChildren( QtLabeledProgressBar ) )
Returns True if the viewer has an active progress bar, else False
qt_viewer_has_pbar
python
napari/napari
src/napari/_qt/dialogs/_tests/test_activity_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/_tests/test_activity_dialog.py
BSD-3-Clause
def assert_pbar_added_to(viewer): """Context manager checks that progress bar is added on construction""" assert not qt_viewer_has_pbar(viewer) yield assert qt_viewer_has_pbar(viewer)
Context manager checks that progress bar is added on construction
assert_pbar_added_to
python
napari/napari
src/napari/_qt/dialogs/_tests/test_activity_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/_tests/test_activity_dialog.py
BSD-3-Clause
def get_qt_labeled_progress_bar(prog, viewer): """Given viewer and progress, finds associated QtLabeledProgressBar""" activity_dialog = viewer.window._qt_viewer.window()._activity_dialog pbar = activity_dialog.get_pbar_from_prog(prog) return pbar
Given viewer and progress, finds associated QtLabeledProgressBar
get_qt_labeled_progress_bar
python
napari/napari
src/napari/_qt/dialogs/_tests/test_activity_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/_tests/test_activity_dialog.py
BSD-3-Clause
def test_activity_dialog_holds_progress(make_napari_viewer): """Progress gets added to dialog & once finished it gets removed""" viewer = make_napari_viewer(show=SHOW) with assert_pbar_added_to(viewer): r = range(100) prog = progress(r) pbar = get_qt_labeled_progress_bar(prog, viewer) ...
Progress gets added to dialog & once finished it gets removed
test_activity_dialog_holds_progress
python
napari/napari
src/napari/_qt/dialogs/_tests/test_activity_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/_tests/test_activity_dialog.py
BSD-3-Clause
def test_progress_with_context(make_napari_viewer): """Test adding/removing of progress bar with context manager""" viewer = make_napari_viewer(show=SHOW) with assert_pbar_added_to(viewer), progress(range(100)) as prog: pbar = get_qt_labeled_progress_bar(prog, viewer) assert pbar.qt_progres...
Test adding/removing of progress bar with context manager
test_progress_with_context
python
napari/napari
src/napari/_qt/dialogs/_tests/test_activity_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/_tests/test_activity_dialog.py
BSD-3-Clause
def test_closing_viewer_no_error(make_napari_viewer): """Closing viewer with active progress doesn't cause RuntimeError""" viewer = make_napari_viewer(show=SHOW) assert not qt_viewer_has_pbar(viewer) with progress(range(100)): assert qt_viewer_has_pbar(viewer) viewer.close()
Closing viewer with active progress doesn't cause RuntimeError
test_closing_viewer_no_error
python
napari/napari
src/napari/_qt/dialogs/_tests/test_activity_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/_tests/test_activity_dialog.py
BSD-3-Clause
def test_progress_nested(make_napari_viewer): """Test nested progress bars are added with QtProgressBarGroup""" viewer = make_napari_viewer(show=SHOW) assert not qt_viewer_has_pbar(viewer) with progress(range(10)) as pbr: assert qt_viewer_has_pbar(viewer) pbr2 = progress(range(2), nest_...
Test nested progress bars are added with QtProgressBarGroup
test_progress_nested
python
napari/napari
src/napari/_qt/dialogs/_tests/test_activity_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/_tests/test_activity_dialog.py
BSD-3-Clause
def test_preferences_dialog_not_dismissed_by_keybind_confirm( qtbot, pref, confirm_key ): """This test ensures that when confirming a keybinding change, the dialog is not dismissed. Notes: * Skipped on macOS CI due to accessibility permissions not being settable on macOS GitHub Actions ru...
This test ensures that when confirming a keybinding change, the dialog is not dismissed. Notes: * Skipped on macOS CI due to accessibility permissions not being settable on macOS GitHub Actions runners. * For this test to pass locally, you need to give the Terminal/iTerm/VSCode ...
test_preferences_dialog_not_dismissed_by_keybind_confirm
python
napari/napari
src/napari/_qt/dialogs/_tests/test_preferences_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/_tests/test_preferences_dialog.py
BSD-3-Clause
def test_error_reporter(qtbot, monkeypatch): """test that QtPluginErrReporter shows any instantiated PluginErrors.""" monkeypatch.setattr( qt_plugin_report, 'standard_metadata', lambda x: {'url': 'https://github.com/example/example'}, ) error_message = 'my special error' tr...
test that QtPluginErrReporter shows any instantiated PluginErrors.
test_error_reporter
python
napari/napari
src/napari/_qt/dialogs/_tests/test_qt_plugin_report.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/_tests/test_qt_plugin_report.py
BSD-3-Clause
def test_open_sample_data_shows_all_readers( make_napari_viewer, tmp_plugin: DynamicPlugin, ): """Checks that sample data callback `_add_sample` shows all readers.""" # Test for bug fixed in #6058 tmp2 = tmp_plugin.spawn(register=True) @tmp_plugin.contribute.reader(filename_patterns=['*.fake'])...
Checks that sample data callback `_add_sample` shows all readers.
test_open_sample_data_shows_all_readers
python
napari/napari
src/napari/_qt/dialogs/_tests/test_reader_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/_tests/test_reader_dialog.py
BSD-3-Clause
def test_screenshot_save(qtbot, tmp_path, filename): """Check passing different extensions with the filename.""" def save_function(path): # check incoming path has extension event when a filename without one # was provided assert filename in path assert '.' in filename or '.png'...
Check passing different extensions with the filename.
test_screenshot_save
python
napari/napari
src/napari/_qt/dialogs/_tests/test_screenshot_dialog.py
https://github.com/napari/napari/blob/master/src/napari/_qt/dialogs/_tests/test_screenshot_dialog.py
BSD-3-Clause
def wake_up(self) -> None: """Wake up QtPoll so it starts polling.""" # Start the timer so that we start polling. We used to poll once # right away here, but it led to crashes. Because we polled during # a paintGL event? if not self.timer.isActive(): self.timer.start(...
Wake up QtPoll so it starts polling.
wake_up
python
napari/napari
src/napari/_qt/experimental/qt_poll.py
https://github.com/napari/napari/blob/master/src/napari/_qt/experimental/qt_poll.py
BSD-3-Clause
def _poll(self) -> None: """Called on camera move or with the timer.""" # Between timers and camera and wake_up() we might be called multiple # times in quick succession. Use an IntervalTimer to ignore these # near-duplicate calls. if self._interval.elapsed_ms < IGNORE_INTERVAL_...
Called on camera move or with the timer.
_poll
python
napari/napari
src/napari/_qt/experimental/qt_poll.py
https://github.com/napari/napari/blob/master/src/napari/_qt/experimental/qt_poll.py
BSD-3-Clause
def elapsed_ms(self) -> float: """The elapsed time since the last call to this property.""" now = time.time() elapsed_seconds = 0 if self._last is None else now - self._last self._last = now return elapsed_seconds * 1000
The elapsed time since the last call to this property.
elapsed_ms
python
napari/napari
src/napari/_qt/experimental/qt_poll.py
https://github.com/napari/napari/blob/master/src/napari/_qt/experimental/qt_poll.py
BSD-3-Clause
def changeIsoThreshold(self, value): """Change isosurface threshold on the layer model. Parameters ---------- value : float Threshold for isosurface. """ with self.layer.events.blocker(self._on_iso_threshold_change): self.layer.iso_threshold = val...
Change isosurface threshold on the layer model. Parameters ---------- value : float Threshold for isosurface.
changeIsoThreshold
python
napari/napari
src/napari/_qt/layer_controls/qt_image_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_image_controls.py
BSD-3-Clause
def changeAttenuation(self, value): """Change attenuation rate for attenuated maximum intensity projection. Parameters ---------- value : Float Attenuation rate for attenuated maximum intensity projection. """ with self.layer.events.blocker(self._on_attenuati...
Change attenuation rate for attenuated maximum intensity projection. Parameters ---------- value : Float Attenuation rate for attenuated maximum intensity projection.
changeAttenuation
python
napari/napari
src/napari/_qt/layer_controls/qt_image_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_image_controls.py
BSD-3-Clause
def _on_interpolation_change(self, event): """Receive layer interpolation change event and update dropdown menu. Parameters ---------- event : napari.utils.event.Event The napari event that triggered this method. """ interp_string = event.value.value ...
Receive layer interpolation change event and update dropdown menu. Parameters ---------- event : napari.utils.event.Event The napari event that triggered this method.
_on_interpolation_change
python
napari/napari
src/napari/_qt/layer_controls/qt_image_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_image_controls.py
BSD-3-Clause
def _on_rendering_change(self): """Receive layer model rendering change event and update dropdown menu.""" with self.layer.events.rendering.blocker(): index = self.renderComboBox.findText( self.layer.rendering, Qt.MatchFlag.MatchFixedString ) self.rend...
Receive layer model rendering change event and update dropdown menu.
_on_rendering_change
python
napari/napari
src/napari/_qt/layer_controls/qt_image_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_image_controls.py
BSD-3-Clause
def _on_depiction_change(self): """Receive layer model depiction change event and update combobox.""" with self.layer.events.depiction.blocker(): index = self.depictionComboBox.findText( self.layer.depiction, Qt.MatchFlag.MatchFixedString ) self.depict...
Receive layer model depiction change event and update combobox.
_on_depiction_change
python
napari/napari
src/napari/_qt/layer_controls/qt_image_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_image_controls.py
BSD-3-Clause
def _update_rendering_parameter_visibility(self): """Hide isosurface rendering parameters if they aren't needed.""" rendering = ImageRendering(self.layer.rendering) iso_threshold_visible = rendering == ImageRendering.ISO self.isoThresholdLabel.setVisible(iso_threshold_visible) se...
Hide isosurface rendering parameters if they aren't needed.
_update_rendering_parameter_visibility
python
napari/napari
src/napari/_qt/layer_controls/qt_image_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_image_controls.py
BSD-3-Clause
def _update_plane_parameter_visibility(self): """Hide plane rendering controls if they aren't needed.""" depiction = VolumeDepiction(self.layer.depiction) visible = ( depiction == VolumeDepiction.PLANE and self.ndisplay == 3 and self.layer.ndim >= 3 ) ...
Hide plane rendering controls if they aren't needed.
_update_plane_parameter_visibility
python
napari/napari
src/napari/_qt/layer_controls/qt_image_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_image_controls.py
BSD-3-Clause
def _on_ndisplay_changed(self): """Update widget visibility based on 2D and 3D visualization modes.""" self._update_interpolation_combo() self._update_plane_parameter_visibility() if self.ndisplay == 2: self.isoThresholdSlider.hide() self.isoThresholdLabel.hide() ...
Update widget visibility based on 2D and 3D visualization modes.
_on_ndisplay_changed
python
napari/napari
src/napari/_qt/layer_controls/qt_image_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_image_controls.py
BSD-3-Clause
def mousePressEvent(self, event): """Update the slider, or, on right-click, pop-up an expanded slider. The expanded slider provides finer control, directly editable values, and the ability to change the available range of the sliders. Parameters ---------- event : napar...
Update the slider, or, on right-click, pop-up an expanded slider. The expanded slider provides finer control, directly editable values, and the ability to change the available range of the sliders. Parameters ---------- event : napari.utils.event.Event The napari ev...
mousePressEvent
python
napari/napari
src/napari/_qt/layer_controls/qt_image_controls_base.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_image_controls_base.py
BSD-3-Clause
def _on_make_colormap(self): """Make new colormap when colorbarLabel (pushbutton) is pressed.""" from napari._qt.utils import get_color from napari.utils.colormaps.colormap_utils import ensure_colormap color = get_color(self, mode='hex') if color: self.layer.colormap...
Make new colormap when colorbarLabel (pushbutton) is pressed.
_on_make_colormap
python
napari/napari
src/napari/_qt/layer_controls/qt_image_controls_base.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_image_controls_base.py
BSD-3-Clause
def _on_colormap_change(self): """Receive layer model colormap change event and update dropdown menu.""" name = self.layer.colormap.name if name not in self.colormapComboBox._allitems and ( cm := AVAILABLE_COLORMAPS.get(name) ): self.colormapComboBox._allitems.add...
Receive layer model colormap change event and update dropdown menu.
_on_colormap_change
python
napari/napari
src/napari/_qt/layer_controls/qt_image_controls_base.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_image_controls_base.py
BSD-3-Clause
def change_color_mode(self): """Change color mode of label layer""" if self.colorModeComboBox.currentData() == LabelColorMode.AUTO.value: self.layer.colormap = self.layer._original_random_colormap else: self.layer.colormap = self.layer._direct_colormap
Change color mode of label layer
change_color_mode
python
napari/napari
src/napari/_qt/layer_controls/qt_labels_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_labels_controls.py
BSD-3-Clause
def changeRendering(self, rendering_mode: LabelsRendering): """Change rendering mode for image display. Parameters ---------- rendering_mode : LabelsRendering Rendering mode used by vispy. Selects a preset rendering mode in vispy that determines how v...
Change rendering mode for image display. Parameters ---------- rendering_mode : LabelsRendering Rendering mode used by vispy. Selects a preset rendering mode in vispy that determines how volume is displayed: * translucent: voxel colors are blended...
changeRendering
python
napari/napari
src/napari/_qt/layer_controls/qt_labels_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_labels_controls.py
BSD-3-Clause
def toggle_selected_mode(self, state): """Toggle display of selected label only. Parameters ---------- state : int Integer value of Qt.CheckState that indicates the check state of selectedColorCheckbox """ self.layer.show_selected_label = ( Qt.Che...
Toggle display of selected label only. Parameters ---------- state : int Integer value of Qt.CheckState that indicates the check state of selectedColorCheckbox
toggle_selected_mode
python
napari/napari
src/napari/_qt/layer_controls/qt_labels_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_labels_controls.py
BSD-3-Clause
def change_preserve_labels(self, state): """Toggle preserve_labels state of label layer. Parameters ---------- state : int Integer value of Qt.CheckState that indicates the check state of preserveLabelsCheckBox """ self.layer.preserve_labels = ( Q...
Toggle preserve_labels state of label layer. Parameters ---------- state : int Integer value of Qt.CheckState that indicates the check state of preserveLabelsCheckBox
change_preserve_labels
python
napari/napari
src/napari/_qt/layer_controls/qt_labels_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_labels_controls.py
BSD-3-Clause
def _on_contour_change(self): """Receive layer model contour value change event and update spinbox.""" with self.layer.events.contour.blocker(): value = self.layer.contour self.contourSpinBox.setValue(value)
Receive layer model contour value change event and update spinbox.
_on_contour_change
python
napari/napari
src/napari/_qt/layer_controls/qt_labels_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_labels_controls.py
BSD-3-Clause
def _on_selected_label_change(self): """Receive layer model label selection change event and update spinbox.""" with self.layer.events.selected_label.blocker(): value = self.layer.selected_label self.selectionSpinBox.setValue(value)
Receive layer model label selection change event and update spinbox.
_on_selected_label_change
python
napari/napari
src/napari/_qt/layer_controls/qt_labels_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_labels_controls.py
BSD-3-Clause
def _on_brush_size_change(self): """Receive layer model brush size change event and update the slider.""" with self.layer.events.brush_size.blocker(): value = self.layer.brush_size value = np.maximum(1, int(value)) if value > self.brushSizeSlider.maximum(): ...
Receive layer model brush size change event and update the slider.
_on_brush_size_change
python
napari/napari
src/napari/_qt/layer_controls/qt_labels_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_labels_controls.py
BSD-3-Clause
def _on_n_edit_dimensions_change(self): """Receive layer model n-dim mode change event and update the checkbox.""" with self.layer.events.n_edit_dimensions.blocker(): value = self.layer.n_edit_dimensions self.ndimSpinBox.setValue(int(value)) self._set_polygon_tool_sta...
Receive layer model n-dim mode change event and update the checkbox.
_on_n_edit_dimensions_change
python
napari/napari
src/napari/_qt/layer_controls/qt_labels_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_labels_controls.py
BSD-3-Clause
def _on_show_selected_label_change(self): """Receive layer model show_selected_labels event and update the checkbox.""" with self.layer.events.show_selected_label.blocker(): self.selectedColorCheckbox.setChecked( self.layer.show_selected_label )
Receive layer model show_selected_labels event and update the checkbox.
_on_show_selected_label_change
python
napari/napari
src/napari/_qt/layer_controls/qt_labels_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_labels_controls.py
BSD-3-Clause
def _on_iso_gradient_mode_change(self): """Receive layer model iso_gradient_mode change event and update dropdown menu.""" with self.layer.events.iso_gradient_mode.blocker(): self.isoGradientComboBox.setCurrentEnum( IsoCategoricalGradientMode(self.layer.iso_gradient_mode) ...
Receive layer model iso_gradient_mode change event and update dropdown menu.
_on_iso_gradient_mode_change
python
napari/napari
src/napari/_qt/layer_controls/qt_labels_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_labels_controls.py
BSD-3-Clause
def paintEvent(self, event): """Paint the colorbox. If no color, display a checkerboard pattern. Parameters ---------- event : qtpy.QtCore.QEvent Event from the Qt context. """ painter = QPainter(self) if self.layer._selected_color is None: ...
Paint the colorbox. If no color, display a checkerboard pattern. Parameters ---------- event : qtpy.QtCore.QEvent Event from the Qt context.
paintEvent
python
napari/napari
src/napari/_qt/layer_controls/qt_labels_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_labels_controls.py
BSD-3-Clause
def changeOpacity(self, value): """Change opacity value on the layer model. Parameters ---------- value : float Opacity value for shapes. Input range 0 - 100 (transparent to fully opaque). """ with self.layer.events.blocker(self._on_opacity_change...
Change opacity value on the layer model. Parameters ---------- value : float Opacity value for shapes. Input range 0 - 100 (transparent to fully opaque).
changeOpacity
python
napari/napari
src/napari/_qt/layer_controls/qt_layer_controls_base.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_layer_controls_base.py
BSD-3-Clause
def changeBlending(self, text): """Change blending mode on the layer model. Parameters ---------- text : str Name of blending mode, eg: 'translucent', 'additive', 'opaque'. """ self.layer.blending = self.blendComboBox.currentData() # opaque and minimu...
Change blending mode on the layer model. Parameters ---------- text : str Name of blending mode, eg: 'translucent', 'additive', 'opaque'.
changeBlending
python
napari/napari
src/napari/_qt/layer_controls/qt_layer_controls_base.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_layer_controls_base.py
BSD-3-Clause
def _radio_button( self, layer, btn_name, mode, edit_button, action_name, extra_tooltip_text='', **kwargs, ): """ Convenience local function to create a RadioButton and bind it to an action at the same time. Parameters ...
Convenience local function to create a RadioButton and bind it to an action at the same time. Parameters ---------- layer : napari.layers.Layer The layer instance that this button controls.n btn_name : str name fo the button mode : Enum ...
_radio_button
python
napari/napari
src/napari/_qt/layer_controls/qt_layer_controls_base.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_layer_controls_base.py
BSD-3-Clause
def _on_mode_change(self, event): """ Update ticks in checkbox widgets when image based layer mode changed. Available modes for base layer are: * PAN_ZOOM * TRANSFORM Parameters ---------- event : napari.utils.event.Event The napari event tha...
Update ticks in checkbox widgets when image based layer mode changed. Available modes for base layer are: * PAN_ZOOM * TRANSFORM Parameters ---------- event : napari.utils.event.Event The napari event that triggered this method. Raises ...
_on_mode_change
python
napari/napari
src/napari/_qt/layer_controls/qt_layer_controls_base.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_layer_controls_base.py
BSD-3-Clause
def _on_editable_or_visible_change(self): """Receive layer model editable/visible change event & enable/disable buttons.""" set_widgets_enabled_with_opacity( self, self._EDIT_BUTTONS, self.layer.editable and self.layer.visible, ) self._set_transform_to...
Receive layer model editable/visible change event & enable/disable buttons.
_on_editable_or_visible_change
python
napari/napari
src/napari/_qt/layer_controls/qt_layer_controls_base.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_layer_controls_base.py
BSD-3-Clause
def _on_blending_change(self): """Receive layer model blending mode change event and update slider.""" with self.layer.events.blending.blocker(): self.blendComboBox.setCurrentIndex( self.blendComboBox.findData(self.layer.blending) )
Receive layer model blending mode change event and update slider.
_on_blending_change
python
napari/napari
src/napari/_qt/layer_controls/qt_layer_controls_base.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_layer_controls_base.py
BSD-3-Clause
def _set_transform_tool_state(self): """ Enable/disable transform button taking into account: * Layer visibility. * Layer editability. * Number of dimensions being displayed. """ set_widgets_enabled_with_opacity( self, [self.tra...
Enable/disable transform button taking into account: * Layer visibility. * Layer editability. * Number of dimensions being displayed.
_set_transform_tool_state
python
napari/napari
src/napari/_qt/layer_controls/qt_layer_controls_base.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_layer_controls_base.py
BSD-3-Clause
def eventFilter(self, qobject, event): """ Event filter implementation to handle the Alt + Left mouse click interaction to reset the layer transform. For more info about Qt Event Filters you can check: https://doc.qt.io/qt-6/eventsandfilters.html#event-filters """ ...
Event filter implementation to handle the Alt + Left mouse click interaction to reset the layer transform. For more info about Qt Event Filters you can check: https://doc.qt.io/qt-6/eventsandfilters.html#event-filters
eventFilter
python
napari/napari
src/napari/_qt/layer_controls/qt_layer_controls_base.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_layer_controls_base.py
BSD-3-Clause
def close(self): """Disconnect events when widget is closing.""" disconnect_events(self.layer.events, self) for child in self.children(): close_method = getattr(child, 'close', None) if close_method is not None: close_method() return super().close(...
Disconnect events when widget is closing.
close
python
napari/napari
src/napari/_qt/layer_controls/qt_layer_controls_base.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_layer_controls_base.py
BSD-3-Clause
def create_qt_layer_controls(layer): """ Create a qt controls widget for a layer based on its layer type. In case of a subclass, the type higher in the layer's method resolution order will be used. Parameters ---------- layer : napari.layers.Layer Layer that needs its controls widg...
Create a qt controls widget for a layer based on its layer type. In case of a subclass, the type higher in the layer's method resolution order will be used. Parameters ---------- layer : napari.layers.Layer Layer that needs its controls widget created. Returns ------- con...
create_qt_layer_controls
python
napari/napari
src/napari/_qt/layer_controls/qt_layer_controls_container.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_layer_controls_container.py
BSD-3-Clause
def _on_ndisplay_changed(self, event): """Responds to a change in the dimensionality displayed in the canvas. Parameters ---------- event : Event Event with the new dimensionality value at `event.value`. """ for widget in self.widgets.values(): if...
Responds to a change in the dimensionality displayed in the canvas. Parameters ---------- event : Event Event with the new dimensionality value at `event.value`.
_on_ndisplay_changed
python
napari/napari
src/napari/_qt/layer_controls/qt_layer_controls_container.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_layer_controls_container.py
BSD-3-Clause
def _display(self, event): """Change the displayed controls to be those of the target layer. Parameters ---------- event : Event Event with the target layer at `event.value`. """ layer = event.value if layer is None: self.setCurrentWidget(...
Change the displayed controls to be those of the target layer. Parameters ---------- event : Event Event with the target layer at `event.value`.
_display
python
napari/napari
src/napari/_qt/layer_controls/qt_layer_controls_container.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_layer_controls_container.py
BSD-3-Clause
def _add(self, event): """Add the controls target layer to the list of control widgets. Parameters ---------- event : Event Event with the target layer at `event.value`. """ layer = event.value controls = create_qt_layer_controls(layer) contro...
Add the controls target layer to the list of control widgets. Parameters ---------- event : Event Event with the target layer at `event.value`.
_add
python
napari/napari
src/napari/_qt/layer_controls/qt_layer_controls_container.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_layer_controls_container.py
BSD-3-Clause
def _remove(self, event): """Remove the controls target layer from the list of control widgets. Parameters ---------- event : Event Event with the target layer at `event.value`. """ layer = event.value controls = self.widgets[layer] self.remov...
Remove the controls target layer from the list of control widgets. Parameters ---------- event : Event Event with the target layer at `event.value`.
_remove
python
napari/napari
src/napari/_qt/layer_controls/qt_layer_controls_container.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_layer_controls_container.py
BSD-3-Clause
def changeCurrentSymbol(self, text): """Change marker symbol of the points on the layer model. Parameters ---------- text : int Index of current marker symbol of points, eg: '+', '.', etc. """ with self.layer.events.symbol.blocker(self._on_current_symbol_chan...
Change marker symbol of the points on the layer model. Parameters ---------- text : int Index of current marker symbol of points, eg: '+', '.', etc.
changeCurrentSymbol
python
napari/napari
src/napari/_qt/layer_controls/qt_points_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_points_controls.py
BSD-3-Clause
def changeCurrentSize(self, value): """Change size of points on the layer model. Parameters ---------- value : float Size of points. """ with self.layer.events.current_size.blocker( self._on_current_size_change ): self.layer.cu...
Change size of points on the layer model. Parameters ---------- value : float Size of points.
changeCurrentSize
python
napari/napari
src/napari/_qt/layer_controls/qt_points_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_points_controls.py
BSD-3-Clause
def change_out_of_slice(self, state): """Toggleout of slice display of points layer. Parameters ---------- state : QCheckBox Checkbox indicating whether to render out of slice. """ # needs cast to bool for Qt6 with self.layer.events.out_of_slice_displ...
Toggleout of slice display of points layer. Parameters ---------- state : QCheckBox Checkbox indicating whether to render out of slice.
change_out_of_slice
python
napari/napari
src/napari/_qt/layer_controls/qt_points_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_points_controls.py
BSD-3-Clause
def change_text_visibility(self, state): """Toggle the visibility of the text. Parameters ---------- state : QCheckBox Checkbox indicating if text is visible. """ with self.layer.text.events.visible.blocker( self._on_text_visibility_change ...
Toggle the visibility of the text. Parameters ---------- state : QCheckBox Checkbox indicating if text is visible.
change_text_visibility
python
napari/napari
src/napari/_qt/layer_controls/qt_points_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_points_controls.py
BSD-3-Clause
def _on_current_symbol_change(self): """Receive marker symbol change event and update the dropdown menu.""" with qt_signals_blocked(self.symbolComboBox): self.symbolComboBox.setCurrentIndex( self.symbolComboBox.findData(self.layer.current_symbol.value) )
Receive marker symbol change event and update the dropdown menu.
_on_current_symbol_change
python
napari/napari
src/napari/_qt/layer_controls/qt_points_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_points_controls.py
BSD-3-Clause
def _on_current_size_change(self): """Receive layer model size change event and update point size slider.""" with qt_signals_blocked(self.sizeSlider): value = self.layer.current_size min_val = min(value) if isinstance(value, list) else value max_val = max(value) if is...
Receive layer model size change event and update point size slider.
_on_current_size_change
python
napari/napari
src/napari/_qt/layer_controls/qt_points_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_points_controls.py
BSD-3-Clause
def changeCurrentFaceColor(self, color: np.ndarray): """Update face color of layer model from color picker user input.""" with self.layer.events.current_face_color.blocker( self._on_current_face_color_change ): self.layer.current_face_color = color
Update face color of layer model from color picker user input.
changeCurrentFaceColor
python
napari/napari
src/napari/_qt/layer_controls/qt_points_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_points_controls.py
BSD-3-Clause
def changeCurrentBorderColor(self, color: np.ndarray): """Update border color of layer model from color picker user input.""" with self.layer.events.current_border_color.blocker( self._on_current_border_color_change ): self.layer.current_border_color = color
Update border color of layer model from color picker user input.
changeCurrentBorderColor
python
napari/napari
src/napari/_qt/layer_controls/qt_points_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_points_controls.py
BSD-3-Clause
def changeFaceColor(self, color: np.ndarray): """Change face color of shapes. Parameters ---------- color : np.ndarray Face color for shapes, color name or hex string. Eg: 'white', 'red', 'blue', '#00ff00', etc. """ with self.layer.events.current_...
Change face color of shapes. Parameters ---------- color : np.ndarray Face color for shapes, color name or hex string. Eg: 'white', 'red', 'blue', '#00ff00', etc.
changeFaceColor
python
napari/napari
src/napari/_qt/layer_controls/qt_shapes_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_shapes_controls.py
BSD-3-Clause
def changeEdgeColor(self, color: np.ndarray): """Change edge color of shapes. Parameters ---------- color : np.ndarray Edge color for shapes, color name or hex string. Eg: 'white', 'red', 'blue', '#00ff00', etc. """ with self.layer.events.current_...
Change edge color of shapes. Parameters ---------- color : np.ndarray Edge color for shapes, color name or hex string. Eg: 'white', 'red', 'blue', '#00ff00', etc.
changeEdgeColor
python
napari/napari
src/napari/_qt/layer_controls/qt_shapes_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_shapes_controls.py
BSD-3-Clause
def _on_edge_width_change(self): """Receive layer model edge line width change event and update slider.""" with self.layer.events.edge_width.blocker(): value = self.layer.current_edge_width value = np.clip(int(value), 0, 40) self.widthSlider.setValue(value)
Receive layer model edge line width change event and update slider.
_on_edge_width_change
python
napari/napari
src/napari/_qt/layer_controls/qt_shapes_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_shapes_controls.py
BSD-3-Clause
def _on_shading_change(self): """Receive layer model shading change event and update combobox.""" with self.layer.events.shading.blocker(): self.shadingComboBox.setCurrentIndex( self.shadingComboBox.findData( SHADING_TRANSLATION[self.layer.shading] ...
Receive layer model shading change event and update combobox.
_on_shading_change
python
napari/napari
src/napari/_qt/layer_controls/qt_surface_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_surface_controls.py
BSD-3-Clause
def _on_tail_width_change(self): """Receive layer model track line width change event and update slider.""" with self.layer.events.tail_width.blocker(): value = int(2 * self.layer.tail_width) self.tail_width_slider.setValue(value)
Receive layer model track line width change event and update slider.
_on_tail_width_change
python
napari/napari
src/napari/_qt/layer_controls/qt_tracks_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_tracks_controls.py
BSD-3-Clause
def _on_properties_change(self): """Change the properties that can be used to color the tracks.""" with qt_signals_blocked(self.color_by_combobox): self.color_by_combobox.clear() self.color_by_combobox.addItems(self.layer.properties_to_color_by) self._on_color_by_change()
Change the properties that can be used to color the tracks.
_on_properties_change
python
napari/napari
src/napari/_qt/layer_controls/qt_tracks_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_tracks_controls.py
BSD-3-Clause
def _on_colormap_change(self): """Receive layer model colormap change event and update combobox.""" with self.layer.events.colormap.blocker(): self.colormap_combobox.setCurrentIndex( self.colormap_combobox.findData(self.layer.colormap) )
Receive layer model colormap change event and update combobox.
_on_colormap_change
python
napari/napari
src/napari/_qt/layer_controls/qt_tracks_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_tracks_controls.py
BSD-3-Clause
def _on_color_by_change(self): """Receive layer model color_by change event and update combobox.""" with self.layer.events.color_by.blocker(): color_by = self.layer.color_by idx = self.color_by_combobox.findText( color_by, Qt.MatchFlag.MatchFixedString ...
Receive layer model color_by change event and update combobox.
_on_color_by_change
python
napari/napari
src/napari/_qt/layer_controls/qt_tracks_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_tracks_controls.py
BSD-3-Clause
def change_edge_color_property(self, property_name: str): """Change edge_color_property of vectors on the layer model. This property is the property the edge color is mapped to. Parameters ---------- property_name : str property to map the edge color to """ ...
Change edge_color_property of vectors on the layer model. This property is the property the edge color is mapped to. Parameters ---------- property_name : str property to map the edge color to
change_edge_color_property
python
napari/napari
src/napari/_qt/layer_controls/qt_vectors_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_vectors_controls.py
BSD-3-Clause
def change_vector_style(self, vector_style: str): """Change vector style of vectors on the layer model. Parameters ---------- vector_style : str Name of vectors style, eg: 'line', 'triangle' or 'arrow'. """ with self.layer.events.vector_style.blocker(): ...
Change vector style of vectors on the layer model. Parameters ---------- vector_style : str Name of vectors style, eg: 'line', 'triangle' or 'arrow'.
change_vector_style
python
napari/napari
src/napari/_qt/layer_controls/qt_vectors_controls.py
https://github.com/napari/napari/blob/master/src/napari/_qt/layer_controls/qt_vectors_controls.py
BSD-3-Clause