Example #1
0
 def __init__(self, parent=None, index=None, leafs=None):
     super(SinglePlot, self).__init__(parent)
     # things to display on the right
     self._stat_groups = ['max', 'mean', 'std', 'min']
     self._displayed_groups = [_POSITION_GROUP, _VALUE_GROUP] \
                              + self._stat_groups
     # store some vars
     self._leafs = leafs if leafs else []
     self._value_names = [l.name for l in self._leafs]
     # stuff that vitables looks for
     self.dbt_leaf = plugin_utils.getVTGui().dbs_tree_model.nodeFromIndex(index)
     self.pindex = qtcore.QPersistentModelIndex(index)
     self.is_context_menu_custom = True
     # gui init stuff
     self.setAttribute(qtcore.Qt.WA_DeleteOnClose)
     self._init_gui()
     # set text edits with some stuff and adjust their size
     plotutils.update_position_info(self._plot, self._info, _POSITION_GROUP)
     self._update_values_info()
     self._update_statistics_info()
     self._info.fit_content()
     # signal slots
     self._mouse_position_proxy = qtgraph.SignalProxy(
         self._plot.scene().sigMouseMoved, rateLimit=30,
         slot=ft.partial(plotutils.update_position_info, self._plot, 
                         self._info, _POSITION_GROUP))
     self._mouse_value_proxy = qtgraph.SignalProxy(
         self._plot.scene().sigMouseMoved, rateLimit=10,
         slot=self._update_values_info)
     self._range_change_proxy = qtgraph.SignalProxy(
         self._plot.sigRangeChanged, rateLimit=10,
         slot=self._update_statistics_info)
Example #2
0
 def __init__(self):
     super(VTPlot, self).__init__()
     
     self._vtgui = plugin_utils.getVTGui()
     self._mdiarea = self._vtgui.workspace
     self._settings = qtcore.QSettings()
     self._logger = plugin_utils.getLogger(defaults.MODULE_NAME)
     self._add_submenu()
     # pyqtgraph options
     qtgraph.setConfigOption('background', 'w')
     qtgraph.setConfigOption('foreground', 'k')
Example #3
0
 def _plot_surface(self, unused):
     """Display two plots: overall view and zoomed to region."""
     index = plugin_utils.getVTGui().dbs_tree_view.currentIndex()
     leaf = plugin_utils.getSelectedLeaf()
     if leaf.dtype.kind == 'c':
         data = np.abs(leaf)
     else:
         data = np.array(leaf)
     plot_window = surfplot.SurfPlot(parent=self._mdiarea, index=index,
                                     leaf=data, leaf_name=leaf._v_pathname)
     self._mdiarea.addSubWindow(plot_window)
     plot_window.show()
Example #4
0
 def __init__(self, parent, index, widget):
     super(DataPlot, self).__init__(parent)
     # store some vars
     self._vtgui = vtpu.getVTGui()
     # window options
     self.setWidget(widget)
     self.setAttribute(qtcore.Qt.WA_DeleteOnClose)
     # stuff that vitables looks for
     self.dbt_leaf = self._vtgui.dbs_tree_model.nodeFromIndex(index)
     self.pindex = qtcore.QPersistentModelIndex(index)
     self.is_context_menu_custom = True
     widget.setParent(self)
Example #5
0
 def _plot_1d_array(self, unused):
     """Display one plot with crosshair ad statistics."""
     index = plugin_utils.getVTGui().dbs_tree_view.currentIndex()
     leafs = plotutils.getSelectedLeafs()
     for leaf in leafs:
         if leaf.dtype.kind in 'cSUV':
             self._logger.error(
                 'Can not plot type: {0}'.format(str(leaf.dtype)))
             return
     plot_window = singleplot.SinglePlot(parent=self._mdiarea,
                                         index=index, leafs=leafs)
     self._mdiarea.addSubWindow(plot_window)
     plot_window.show()
Example #6
0
 def _plot_1d_array_with_zoom(self, unused):
     """Display two plots: overall view and zoomed to region."""
     index = plugin_utils.getVTGui().dbs_tree_view.currentIndex()
     leafs = plotutils.getSelectedLeafs()
     for leaf in leafs:
         if leaf.dtype.kind in 'cSUV':
             self._logger.error(
                 'Can not plot type: {0}'.format(str(leaf.dtype)))
             return
     plot_window = dualplot.DualPlot(parent=self._mdiarea, 
                                     index=index, leafs=leafs)
     self._mdiarea.addSubWindow(plot_window)
     plot_window.show()
Example #7
0
 def __init__(self, parent=None, index=None, leaf=None, leaf_name=None):
     super(SurfPlot, self).__init__(parent)
     self._leaf_name = leaf_name if leaf_name else 'none'
     self._data = leaf
     self._stat_groups = ['max', 'mean', 'min']
     self._displayed_groups = [_CURSOR_GROUP,
                               _ROI_GROUP] + self._stat_groups
     # gui stuff
     self.setAttribute(qtcore.Qt.WA_DeleteOnClose)
     self._init_gui()
     # stuff that vitables looks for
     self.dbt_leaf = plugin_utils.getVTGui().dbs_tree_model.nodeFromIndex(index)
     self.pindex = qtcore.QPersistentModelIndex(index)
     self.is_context_menu_custom = True
Example #8
0
def addToLeafContextMenu(actions, enable_function=None):
    """Add entries at the end of the leaf context menu.

    The function accept a QAction/QMenu or an iterable. Entries will be
    preceded with a separator and added at the end of the menu.

    :parameter actions: QAction/QMenu object or a list of such objects

    :return: None
    """
    vtgui = plugin_utils.getVTGui()
    context_menu = vtgui.leaf_node_cm
    plugin_utils.addToMenu(context_menu, actions)
    if enable_function:
        context_menu.aboutToShow.connect(enable_function)
Example #9
0
def getDBsTreeView():
    return plugin_utils.getVTGui().dbs_tree_view