Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@QtCore.Slot()
def set_tilt_point3(self):
"""Gets the third reference point for tilt correction."""
self.point3 = np.array(self._scanning_device.get_scanner_position()[:3])
self.signal_tilt_correction_update.emit()
@QtCore.Slot(str)
def set_alternative_data_type(self, alt_data_type):
"""
@param alt_data_type:
@return:
"""
if isinstance(alt_data_type, str):
self.sigAlternativeDataTypeChanged.emit(alt_data_type)
return
@Slot(str, int, str, object)
def load(self, filenames=None, goto=None, word='',
editorwindow=None, processevents=True, start_column=None,
set_focus=True, add_where='end'):
"""
Load a text file
editorwindow: load in this editorwindow (useful when clicking on
outline explorer with multiple editor windows)
processevents: determines if processEvents() should be called at the
end of this method (set to False to prevent keyboard events from
creeping through to the editor during debugging)
"""
# Switch to editor before trying to load a file
try:
self.switch_to_plugin()
except AttributeError:
pass
@Slot(object)
def show_syspath(self, syspath):
"""Show sys.path contents."""
if syspath is not None:
editor = CollectionsEditor(self)
editor.setup(syspath, title="sys.path contents", readonly=True,
width=600, icon=ima.icon('syspath'))
self.dialog_manager.show(editor)
else:
return
@QtCore.Slot()
def _z_slider_released(self):
pos_dict = {'z': self._mw.z_slider.value()}
self._update_target_display(pos_dict, exclude_widget=self._mw.z_slider)
self.move_scanner_position(pos_dict)
return
@QtCore.Slot(int)
def set_number_of_plots(self, plt_count):
with self.threadlock:
if not isinstance(plt_count, int):
raise TypeError
if plt_count < 1:
self.log.error('number of plots must be integer >= 1.')
return
while self.number_of_plots < plt_count:
self.add_plot()
while self.number_of_plots > plt_count:
self.remove_plot()
@Slot()
def toggle_buttons(self):
"""Toggle + and - buttons."""
if len(self.table.selectedItems()) == 2: # one row (2 items) selected
self.add_button.setEnabled(True)
self.remove_button.setEnabled(True)
elif len(self.table.selectedItems()) > 2: # more than one row selected
self.add_button.setEnabled(False)
self.remove_button.setEnabled(True)
else: # no rows selected
self.add_button.setEnabled(False)
self.remove_button.setEnabled(False)
@Slot(int)
@Slot(object)
def setCurrentLine(self, line):
cursor = QTextCursor(self.document().findBlockByLineNumber(line - 1))
self.setTextCursor(cursor)
self.centerCursor()
@Slot(bool, object)
def _finish_command(self, executed, result):
if result is not None:
self._insert_output_text(
repr(result),
prompt=self._ps_out % self._current_line)
self._insert_output_text('\n')
if executed and self._last_input:
self._current_line += 1
self._more = False
self._show_cursor()
self._update_ps(self._more)
self._show_ps()
@Slot(bool)
@Slot(list)
def import_data(self, filenames=None):
"""Import data from text file."""
title = _("Import data")
if filenames is None:
if self.filename is None:
basedir = getcwd()
else:
basedir = osp.dirname(self.filename)
filenames, _selfilter = getopenfilenames(self, title, basedir,
iofunctions.load_filters)
if not filenames:
return
elif is_text_string(filenames):
filenames = [filenames]