How to use the vaex.ui 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 / test / ui.py View on Github external
def test_select_by_expression(self):
		self.window.xlabel = "x"
		self.window.ylabel = "y"
		##self.window._wait() # TODO: is this a bug? if we don't wait and directly do the selection, the ThreadPoolIndex
		## is entered twice, not sure this can happen from the gui
		vaex.ui.qt.set_choose("x < 0", True)
		logger.debug("click mouse")
		QtTest.QTest.mouseClick(self.layer.button_selection_expression, QtCore.Qt.LeftButton)
		logger.debug("clicked mouse")
		return
		self.window._wait()
		self.assertTrue(self.no_exceptions)

		filename = self.window.plot_to_png()
		self.compare(filename, get_comparison_image("example_xy_selection_on_x"))
github vaexio / vaex / python / vaex / ui / metatable.py View on Github external
def __init__(self, parent, menu=None):
		super(MetaTable, self).__init__(parent)
		#dataset.add_virtual_column("xp", "x")
		self.event_handler = None
		self.resize(700, 500)
		self.tableView = QtGui.QTableView()
		#self.tableView.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows);
		#self.header = self.dataset.column_names
		#self.tableView.pressed.connect(self.onSelectRow)

		self.tableView.verticalHeader().setResizeMode(QtGui.QHeaderView.Interactive)
		self.tableView.setItemDelegateForColumn(4, vaex.ui.completer.UnitDelegate(self))
		self.tableView.setItemDelegateForColumn(5, vaex.ui.completer.UCDDelegate(self))

		self.toolbar = QtGui.QToolBar(self)
		#self.description = QtGui.QTextEdit(self.dataset.description, self)
		#self.description.setFixedHeight(100)
		#self.description.textChanged.connect(self.onTextChanged)

		#self.action_group_add = QtGui.QActionGroup(self)

		self.action_add = QtGui.QAction(QtGui.QIcon(iconfile('table-insert-column')), 'Add virtual column', self)
		self.action_remove = QtGui.QAction(QtGui.QIcon(iconfile('table-delete-column')), 'Remove virtual column', self)
		self.action_remove.setEnabled(False)
		self.action_add.setShortcut("Ctrl++")
		self.action_remove.setShortcut("Ctrl+-")

		self.toolbar.addAction(self.action_add)
		self.toolbar.addAction(self.action_remove)
github vaexio / vaex / packages / vaex-ui / vaex / ui / plugin / transferfunction.py View on Github external
from vaex.ui.qt import *
import vaex.ui.plot_windows



#from vaex.ui.icons import iconfile
#import matplotlib.widgets
#import functools
import logging
from vaex.ui import widgets

logger = logging.getLogger("plugin.transferfunction")


@vaex.ui.plugin.pluginclass
class TransferFunctionPlugin(vaex.ui.plugin.PluginLayer):
	name = "transferfunction"
	def __init__(self, parent, layer):
		super(TransferFunctionPlugin, self).__init__(parent, layer)
		layer.plug_page(self.plug_page, "Transfer function", 2.5, 1.0)
		self.properties = [] # list of names with set_ and get_

	@staticmethod
	def useon(dialog_class):
		return issubclass(dialog_class, vaex.ui.plot_windows.VolumeRenderingPlotDialog)

	def plug_page(self, page):
		layout = self.layout = QtGui.QGridLayout()
		self.widget_volume = self.layer.plot_window.widget_volume
		page.setLayout(self.layout)
		layout.setSpacing(0)
		layout.setContentsMargins(0,0,0,0)
github vaexio / vaex / packages / vaex-ui / vaex / ui / plugin / vector3d.py View on Github external
def useon(dialog_class):
		return issubclass(dialog_class, vaex.ui.plot_windows.VolumeRenderingPlotDialog)
github vaexio / vaex / packages / vaex-ui / vaex / ui / plugin / animation.py View on Github external
__author__ = 'maartenbreddels'

import time

import vaex.ui.plugin
from vaex.ui.qt import *


#import vaex.plot_windows

import logging
#import vaex.ui.undo as undo

logger = logging.getLogger("vaex.ui.plugin.animation")

class AnimationPlugin(vaex.ui.plugin.PluginLayer):
	name = "animation"
	def __init__(self, parent, layer):
		super(AnimationPlugin, self).__init__(parent, layer)
		layer.plug_page(self.plug_page, "Animation", 6.0, 1.0)

		self.timer_sequence = QtCore.QTimer(parent)
		self.timer_sequence.timeout.connect(self.on_timeout_sequence)
		self.timer_sequence.setInterval(40) # max 50 fps to save cpu/battery?
		self.has_snapshots = self.dataset.has_snapshots()

		self.no_snapshots = self.dataset.rank1s[list(self.dataset.rank1s.keys())[0]].shape[0] if self.has_snapshots else 0
		#self.plot_original = self.dialog.plot
		#self.dialog.plot = self.plot_wrapper


		def on_plot_finished(plot_window, figure):
github vaexio / vaex / python / vaex / dataset.py View on Github external
self.serie_index_selection_listeners = []
		#self.mask_listeners = []

		self.all_columns = {}
		self.all_column_names = []
		self.mask = None
		self.global_links = {}
		
		self.offsets = {}
		self.strides = {}
		self.filenames = {}
		self.dtypes = {}
		self.samp_id = None
		#self.variables = collections.OrderedDict()
		
		self.undo_manager = vaex.ui.undo.UndoManager()
github vaexio / vaex / python / vaex / ui / plot_windows.py View on Github external
def add_layer(self, expressions, dataset=None, name=None, **options):
		if dataset is None:
			dataset = self.dataset
		if name is None:
			name = options.get("layer_name", "Layer: " + str(len(self.layers)+1))
		ranges = copy.deepcopy(self.ranges_show)
		logger.debug("adding layer {name} with expressions {expressions} for dataset {dataset} and options {options}".format(**locals()))

		if len(self.layers) > 0:
			first_layer = self.layers[0]
			assert len(expressions) == first_layer.dimensions
			for i in range(self.dimensions):
				if ranges[i] is None and first_layer.ranges_grid[i] is not None:
					ranges[i] = copy.copy(first_layer.ranges_grid[i])
		layer = vaex.ui.layers.LayerTable(self, name, dataset, expressions, self.axisnames, options, self.pool, self.fig, self.canvas, ranges)
		self.layers.append(layer)
		layer.build_widget_qt(self.widget_layer_stack) # layer.widget is the widget build
		self.widget_layer_stack.addWidget(layer.widget)

		#layer.build_widget_qt_layer_control(self.frame_layer_controls)
		#self.layout_frame_layer_controls.addWidget(layer.widget_layer_control)

		layer.widget.setVisible(False)
		self.layer_selection.addItem(name)
		#self.layer_selection.setCurrentIndex(len(self.layers))
		self.select_layer(len(self.layers)-1)



		def on_expression_change(layer, axis_index, expression):
			if not self.axis_lock: # and len(self.layers) == 1:
github vaexio / vaex / python / vaex / ui / plot_windows.py View on Github external
self.setWindowTitle(self.name)
		self.dataset = dataset
		self.axisnames = axisnames
		self.pool = ThreadPool()
		#self.expressions = expressions
		#self.dimensions = len(self.expressions)
		#self.grids = Grids(self.dataset, self.pool, *self.expressions)

		if self.dimensions == 3:
			self.resize(800+400,700)
		else:
			self.resize(800,700)


		self.plugin_queue_toolbar = [] # list of tuples (callback, order)
		self.plugins = [cls(self) for cls in vaex.ui.plugin.PluginPlot.registry if cls.useon(self.__class__)]
		self.plugins_map = {plugin.name:plugin for plugin in self.plugins}
		#self.plugin_zoom = plugin.zoom.ZoomPlugin(self)

		self.aspect = None
		self.axis_lock = False

		self.update_counter = 0
		self.t_0 = 0
		self.t_last = 0
		self.slice_radius = 0.05

		self.shortcuts = []
		self.messages = {}

		default_grid_size = 256 if self.dimensions == 2 else 128
		self.grid_size = eval(self.options.get("grid_size", str(default_grid_size)))
github vaexio / vaex / packages / vaex-ui / vaex / ui / main.py View on Github external
for power in [-1.5, -2.5]:
                    count = N**dim
                    name = 'Zeldovich d={dim} N={N:,}, count={count:,} powerspectrum={power:}'.format(**locals())
                    action = QtGui.QAction('Generate ' + name, self)

                    def do(ignore=None, dim=dim, N=N, power=power, name=name):
                        t = None
                        z = vx.file.other.Zeldovich(dim, N, power, t, name=name)
                        self.dataset_selector.add(z)
                    action.triggered.connect(do)
                    self.menu_data.addAction(action)

        self.menu_columns = menubar.addMenu('&Columns')
        self.columns_panel = vaex.ui.columns.ColumnsTable(self.tabs, menu=self.menu_columns)
        self.tabs.addTab(self.columns_panel, "Columns")
        self.variables_panel = vaex.ui.variables.VariablesTable(self.tabs, menu=self.menu_columns)
        self.tabs.addTab(self.variables_panel, "Variables")

        use_toolbar = "darwin" not in platform.system().lower()
        use_toolbar = True
        self.toolbar.setIconSize(QtCore.QSize(16, 16))
        # self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)

        # self.toolbar.addAction(exitAction)
        if self.enable_samp:
            self.action_samp_connect = QtGui.QAction(QtGui.QIcon(vp.iconfile('plug-connect')), 'Connect to SAMP HUB', self)
            self.action_samp_connect.setShortcut('Alt+S')
            self.action_samp_connect.setCheckable(True)
            if use_toolbar:
                self.toolbar.addAction(self.action_samp_connect)
            self.action_samp_connect.triggered.connect(self.onSampConnect)
github vaexio / vaex / packages / vaex-ui / vaex / ui / plugin / favorites.py View on Github external
from __future__ import print_function
import sys

import vaex.ui.plugin
from vaex.ui.qt import *
from vaex.ui.icons import iconfile
import vaex.events
import logging
import vaex.ui.storage


logger = logging.getLogger("plugin.favorites")


storage_plots = vaex.ui.storage.Storage("favorite-plots")

class FavStorePlugin(vaex.ui.plugin.PluginPlot):
	name="favorites"
	def __init__(self, dialog):
		super(FavStorePlugin, self).__init__(dialog)
		dialog.plug_toolbar(self.plug_toolbar, 1.1)

	def plug_toolbar(self):
		logger.info("adding %s plugin" % self.name)
		self.menu = QtGui.QMenu("F&avorites")
		self.dialog.menu_bar.addMenu(self.menu)

		self.action_store  = QtGui.QAction(QtGui.QIcon(iconfile('star')), 'Store', self.dialog)
		self.action_store.setShortcut("Ctrl+B")
		self.action_store_toolbar  = QtGui.QAction(QtGui.QIcon(iconfile('star')), 'Store', self.dialog)