def activate_command(self, plot, checked): """Activate tool""" # show a dialog models, ok = TaurusModelChooser.modelChooserDlg( parent=plot, selectables=[TaurusElementType.Attribute]) if ok: # create image items and add them to the plot for m in models: item = make.image(taurusmodel=m) plot.add_item(item)
def activate_command(self, plot, checked): """Activate tool""" # show a dialog models, ok = TaurusModelChooser.modelChooserDlg( parent=plot, selectables=[TaurusElementType.Attribute]) if ok: # create image items and add them to the plot for m in models: item = make.image(taurusmodel=m) plot.add_item(item)
def taurusImageMain(): from guiqwt.tools import (RectangleTool, EllipseTool, HRangeTool, PlaceAxesTool, MultiLineTool, FreeFormTool, SegmentTool, CircleTool, AnnotatedRectangleTool, AnnotatedEllipseTool, AnnotatedSegmentTool, AnnotatedCircleTool, LabelTool, AnnotatedPointTool, ObliqueRectangleTool, AnnotatedObliqueRectangleTool) try: # In newer guiqwt versions, Annotated*CursorTool have been replaced by *CursorTool from guiqwt.tools import AnnotatedVCursorTool, AnnotatedHCursorTool VCursorTool, HCursorTool = AnnotatedVCursorTool, AnnotatedHCursorTool except ImportError: from guiqwt.tools import VCursorTool, HCursorTool from taurus.qt.qtgui.extra_guiqwt.tools import TaurusImageChooserTool from guiqwt.plot import ImageDialog from taurus.qt.qtgui.extra_guiqwt.builder import make from taurus.qt.qtgui.application import TaurusApplication import taurus.core.util.argparse import sys parser = taurus.core.util.argparse.get_taurus_parser() parser.set_usage("%prog [options] [<model1> [<model2>] ...]") parser.set_description("a taurus application for plotting 2D data sets") app = TaurusApplication(cmd_line_parser=parser, app_name="taurusimage", app_version=taurus.Release.version) args = app.get_command_line_args() # create a dialog with a plot and add the images win = ImageDialog(edit=False, toolbar=True, wintitle="Taurus Image", options=dict(show_xsection=False, show_ysection=False)) # add tools for toolklass in (TaurusImageChooserTool, LabelTool, HRangeTool, MultiLineTool, FreeFormTool, PlaceAxesTool, AnnotatedObliqueRectangleTool, AnnotatedEllipseTool, AnnotatedSegmentTool, AnnotatedPointTool, VCursorTool, HCursorTool): win.add_tool(toolklass) # add images from given models plot = win.get_plot() for m in args: img = make.image(taurusmodel=m) plot.add_item(img) # IMPORTANT: connect the cross section plots to the taurusimage so that # they are updated when the taurus data changes win.connect(img.getSignaller(), Qt.SIGNAL("dataChanged"), win.update_cross_sections) win.exec_()
def taurusImageMain(): from guiqwt.tools import (RectangleTool, EllipseTool, HRangeTool, PlaceAxesTool, MultiLineTool, FreeFormTool, SegmentTool, CircleTool, AnnotatedRectangleTool, AnnotatedEllipseTool, AnnotatedSegmentTool, AnnotatedCircleTool, LabelTool, AnnotatedPointTool, ObliqueRectangleTool, AnnotatedObliqueRectangleTool) try: # In newer guiqwt versions, Annotated*CursorTool have been replaced by *CursorTool from guiqwt.tools import AnnotatedVCursorTool, AnnotatedHCursorTool VCursorTool, HCursorTool = AnnotatedVCursorTool, AnnotatedHCursorTool except ImportError: from guiqwt.tools import VCursorTool, HCursorTool from taurus.qt.qtgui.extra_guiqwt.tools import TaurusImageChooserTool from guiqwt.plot import ImageDialog from taurus.qt.qtgui.extra_guiqwt.builder import make from taurus.qt.qtgui.application import TaurusApplication import taurus.core.util.argparse import sys parser = taurus.core.util.argparse.get_taurus_parser() parser.set_usage("%prog [options] [<model1> [<model2>] ...]") parser.set_description("a taurus application for plotting 2D data sets") app = TaurusApplication( cmd_line_parser=parser, app_name="taurusimage", app_version=taurus.Release.version) args = app.get_command_line_args() # create a dialog with a plot and add the images win = ImageDialog(edit=False, toolbar=True, wintitle="Taurus Image", options=dict(show_xsection=False, show_ysection=False)) # add tools for toolklass in (TaurusImageChooserTool, LabelTool, HRangeTool, MultiLineTool, FreeFormTool, PlaceAxesTool, AnnotatedObliqueRectangleTool, AnnotatedEllipseTool, AnnotatedSegmentTool, AnnotatedPointTool, VCursorTool, HCursorTool): win.add_tool(toolklass) # add images from given models plot = win.get_plot() for m in args: img = make.image(taurusmodel=m) plot.add_item(img) # IMPORTANT: connect the cross section plots to the taurusimage so that # they are updated when the taurus data changes img.dataChanged.connect(win.update_cross_sections) win.exec_()
def test1(): """Adapted from guiqwt cross_section.py example""" from guiqwt.plot import ImageDialog from taurus.qt.qtgui.extra_guiqwt.builder import make from taurus.qt.qtgui.application import TaurusApplication app = TaurusApplication(cmd_line_parser=None) # define a taurus image #model1 = 'sys/tg_test/1/short_image_ro' #model1 = 'sys/tg_test/1/long64_image_ro' model1 = 'sys/tg_test/1/ulong_image_ro' taurusimage = make.image(taurusmodel=model1) #taurusrgbimage = make.rgbimage(taurusmodel= 'eval:array([[[ 222, 0, 0], [0, 222, 0]], [[0, 0, 222], [222, 222, 222]]])') #taurusxyimage= make.xyimage(taurusmodel= model1) #taurusxyimage.set_xy(numpy.arange(251)*10,numpy.arange(251)*100 ) # define normal image (guiqwt standard) #data = numpy.random.rand(100,100) #image = make.image(data=data) # create a dialog with a plot and add the images win = ImageDialog(edit=False, toolbar=True, wintitle="Taurus Cross sections test", options=dict(show_xsection=False, show_ysection=False)) from taurus.qt.qtgui.extra_guiqwt.tools import TaurusImageChooserTool win.add_tool(TaurusImageChooserTool) plot = win.get_plot() plot.add_item(taurusimage) # plot.add_item(taurusxyimage) # plot.add_item(image) # plot.add_item(taurusrgbimage) # win.get_itemlist_panel().show() # IMPORTANT: connect the cross section plots to the taurusimage so that they are updated when the taurus data changes # taurusimage.dataChanged.connect(win.update_cross_sections) win.exec_()
def setModel(self, model): '''reimplemented from :class:`TaurusBaseWidget`''' if self.getUseParentModel(): # @fixme: This assumes Tango models. model = "/".join((str(self.getParentModelName()), str(model))) plot = self.get_plot() if self.imgItem is not None: try: plot.del_item(self.imgItem) except: self.info("Unable to delete item from plot") if not model: self.imgItem = None return if self.rgbmode: self.imgItem = make.rgbimage(taurusmodel=model) else: self.imgItem = make.image(taurusmodel=model) plot.add_item(self.imgItem) self.imgItem.set_readonly(not self.isModifiableByUser()) # IMPORTANT: connect the cross section plots to the taurusimage so that # they are updated when the taurus data changes self.imgItem.dataChanged.connect(self.update_cross_sections)
def test1(): """Adapted from guiqwt cross_section.py example""" from guiqwt.plot import ImageDialog from taurus.qt.qtgui.extra_guiqwt.builder import make from taurus.qt.qtgui.application import TaurusApplication app = TaurusApplication() # define a taurus image #model1 = 'sys/tg_test/1/short_image_ro' #model1 = 'sys/tg_test/1/long64_image_ro' model1 = 'sys/tg_test/1/ulong_image_ro' taurusimage = make.image(taurusmodel=model1) #taurusrgbimage = make.rgbimage(taurusmodel= 'eval:array([[[ 222, 0, 0], [0, 222, 0]], [[0, 0, 222], [222, 222, 222]]])') #taurusxyimage= make.xyimage(taurusmodel= model1) #taurusxyimage.set_xy(numpy.arange(251)*10,numpy.arange(251)*100 ) # define normal image (guiqwt standard) #data = numpy.random.rand(100,100) #image = make.image(data=data) # create a dialog with a plot and add the images win = ImageDialog(edit=False, toolbar=True, wintitle="Taurus Cross sections test", options=dict(show_xsection=False, show_ysection=False)) from taurus.qt.qtgui.extra_guiqwt.tools import TaurusImageChooserTool win.add_tool(TaurusImageChooserTool) plot = win.get_plot() plot.add_item(taurusimage) # plot.add_item(taurusxyimage) # plot.add_item(image) # plot.add_item(taurusrgbimage) # win.get_itemlist_panel().show() # IMPORTANT: connect the cross section plots to the taurusimage so that they are updated when the taurus data changes # taurusimage.dataChanged.connect(win.update_cross_sections) win.exec_()