How to use the vaex.ui.qt.dialog_error function in vaex

To help you get started, we’ve selected a few vaex examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vaexio / vaex / packages / vaex-ui / vaex / ui / variables.py View on Github external
# unit = astropy.units.Unit(value)
        # logger.debug("setting unit to: %s (%s)" % (value, unit))
        # self.dataset.units[column_name] = unit
        # # TODO: move to dataset class
        # self.dataset.signal_column_changed.emit(self.dataset, column_name, "change")
        # except Exception, e:
        # dialogs.dialog_error(None, "Cannot parse unit", "Cannot parse unit:\n %s" % e)
        # else:
        # if column_name in self.dataset.units:
        # del self.dataset.units[column_name]
        if property == "Expression":
            try:
                test = eval(value, vaex.dataset.expression_namespace, self.dataset.variables)
                self.dataset.add_variable(variable_name, value)
            except Exception as e:
                dialogs.dialog_error(None, "Invalid expression", "Invalid expression: %s" % e)
            # although it may not be a valid expression, still set it to the user can edit it
            # self.dataset.virtual_columns[column_name] = value

        self.dataset.write_meta()
        return True
github vaexio / vaex / packages / vaex-ui / vaex / ui / layers.py View on Github external
self.plugins_map["transferfunction"].tool.colormap = self.state.colormap
					self.plugins_map["transferfunction"].tool.update()
					self.widget_volume.colormap_index = index
					self.widget_volume.update()
				#self.plot()
				self.signal_plot_dirty.emit(self)
			cmapnames = "cmap colormap colourmap".split()
			if not set(cmapnames).isdisjoint(self.options):
				for name in cmapnames:
					if name in self.options:
						break
				cmap = self.options[name]
				if cmap not in vaex.ui.colormaps.colormaps:
					colormaps_sorted = sorted(vaex.ui.colormaps.colormaps)
					colormaps_string = " ".join(colormaps_sorted)
					dialogs.dialog_error(self, "Wrong colormap name", "colormap {cmap} does not exist, choose between: {colormaps_string}".format(**locals()))
					index = 0
				else:
					index = vaex.ui.colormaps.colormaps.index(cmap)
				self.colormap_box.setCurrentIndex(index)
				self.state.colormap = vaex.ui.colormaps.colormaps[index]
			self.colormap_box.currentIndexChanged.connect(onColorMap)

		row += 1

		self.contour_count = int(self.options.get("contour_count", 4))
		self.slider_contour_count = Slider(page_widget, "contour_count", 0, 20, 20, getter=attrgetter(self, "contour_count"), setter=attrsetter(self, "contour_count"), update=self.signal_plot_dirty.emit, format="{0:<3d}", numeric_type=int)
		row = self.slider_contour_count.add_to_grid_layout(row, grid_layout)
github vaexio / vaex / python / vaex / ui / metatable.py View on Github external
if property == "Description":
			self.dataset.descriptions[column_name] = value
		if property == "UCD":
			self.dataset.ucds[column_name] = value
			# TODO: move to dataset class
			self.dataset.signal_column_changed.emit(self.dataset, column_name, "change")
		if property == "Units":
			if value:
				try:
					unit = astropy.units.Unit(value)
					logger.debug("setting unit to: %s (%s)" % (value, unit))
					self.dataset.units[column_name] = unit
					# TODO: move to dataset class
					self.dataset.signal_column_changed.emit(self.dataset, column_name, "change")
				except Exception, e:
					dialogs.dialog_error(None, "Cannot parse unit", "Cannot parse unit:\n %s" % e)
			else:
				if column_name in self.dataset.units:
					del self.dataset.units[column_name]
		if property == "Expression":
			try:
				self.dataset.validate_expression(value)
			except Exception, e:
				dialogs.dialog_error(None, "Invalid expression", "Invalid expression: %s" % e)
			# although it may not be a valid expression, still set it to the user can edit it
			self.dataset.virtual_columns[column_name] = value

		self.dataset.write_meta()
		return True
github vaexio / vaex / python / vaex / ui / plot_windows.py View on Github external
else:
				path = self.dataset.name + "-selection.yaml"
				path = dialogs.get_path_save(self, "Save selection", path, "YAML (*.yaml);;JSON (*.json)")
				if path:
					_, ext = os.path.splitext(path)
					data = self.dataset.get_selection().to_dict()
					if ext == ".yaml":
						import yaml
						with open(path, "w") as f:
							yaml.dump(data, f)
					elif ext == ".json":
						import json
						with open(path, "w") as f:
							json.dump(data, f)
					else:
						dialogs.dialog_error(self, "Unknown extension", "Unknown extension %r" % ext)
					#np.save(path, self.dataset.mask)
github vaexio / vaex / packages / vaex-ui / vaex / ui / layers.py View on Github external
def slice_link(self, layer):
		if self.plot_window.state.grid_size != layer.plot_window.state.grid_size:
			msg = "Source layer has a gridsize of %d, while the linked layer has a gridsize of %d, only linking with equal gridsize is supported" % (self.plot_window.state.grid_size, layer.plot_window.state.grid_size)
			dialogs.dialog_error(self.plot_window, "Unequal gridsize", msg)
			return
		dim = self.plot_window.dimensions * layer.plot_window.dimensions
		bytes_required = (layer.plot_window.state.grid_size ** dim) * 8
		if memory_check_ok(self.plot_window, bytes_required):
			name = layer.plot_window.name + "." + layer.name
			self.menu_button_slice_link.setText(name)
			self.slice_unlink()

			self.layer_slice_source = layer
			self.slice_axis = [True] * layer.dimensions
			shape = (layer.plot_window.state.grid_size, ) * layer.dimensions
			self.slice_selection_grid = np.ones(shape, dtype=np.bool)
			self.layer_slice_source.signal_slice_change.connect(self.on_slice_change)
			self.layer_slice_source.signal_needs_update.connect(self.on_slice_source_needs_update)
			self.update()
github vaexio / vaex / python / vaex / ui / plot_windows.py View on Github external
def on_load_selection():
			path = self.dataset.name + "-selection.yaml"
			path = get_path_open(self, "Open selection", path, "Compatible files for vaex (*.yaml *.json)")
			if path:
				_, ext = os.path.splitext(path)
				if ext == ".yaml":
					import yaml
					with open(path) as f:
						data = yaml.load(f)
				elif ext == ".json":
					import json
					with open(path) as f:
						json.load(f)
				else:
					dialogs.dialog_error(self, "Unknown extension", "Unknown extension %r" % ext)
				try:
					selection = vaex.dataset.selection_from_dict(self.dataset, data)
				except Exception, e:
					logger.exception("error reading in selection")
					dialogs.dialog_error(self, "Error reading in selection", "Error reading in selection: %r" % e)
				self.dataset.set_selection(selection)
				self.queue_update()
		self.action_selection_load = QtGui.QAction(QtGui.QIcon(iconfile('tag-import')), '&Load selection', self)