Ejemplo n.º 1
0
def main1():
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication(sys.argv)
    form = demo()
    form.show()
    sys.exit(app.exec_())
Ejemplo n.º 2
0
def demo3():
    '''simple demo including more than one widget'''

    import sys
    from taurus.qt.qtgui.application import TaurusApplication
    from taurus.qt.qtgui.display import TaurusLabel, TaurusLed
    from taurus.qt.qtgui.input import TaurusValueLineEdit, TaurusValueCheckBox

    app = TaurusApplication()

    w1 = TaurusReadWriteSwitcher(readWClass=TaurusLabel,
                                 writeWClass=TaurusValueLineEdit)
    w1.model = "sys/tg_test/1/long_scalar"

    w2 = TaurusReadWriteSwitcher(readWClass=TaurusLed,
                                 writeWClass=TaurusValueCheckBox)
    w2.model = "sys/tg_test/1/boolean_scalar"

    f = Qt.QWidget()
    f.setLayout(Qt.QVBoxLayout())
    f.layout().addWidget(w1)
    f.layout().addWidget(w2)
    f.layout().addWidget(TaurusReadWriteSwitcher())  # add non-initialized switcher
    f.show()

    sys.exit(app.exec_())
Ejemplo n.º 3
0
def TaurusPanelMain():
    '''A launcher for TaurusPanel.'''
    # NOTE: DON'T PUT TEST CODE HERE.
    # THIS IS CALLED FROM THE LAUNCHER SCRIPT (<taurus>/scripts/tauruspanel)
    from taurus.qt.qtgui.application import TaurusApplication
    from taurus.core.util import argparse
    import sys

    parser = argparse.get_taurus_parser()
    parser.set_usage("%prog [options] [devname]")
    parser.set_description("Taurus Application inspired in Jive and Atk Panel")

    app = TaurusApplication(cmd_line_parser=parser, app_name="tauruspanel",
                            app_version=taurus.Release.version)
    args = app.get_command_line_args()
    options = app.get_command_line_options()

    w = TaurusDevPanel()

    if options.tango_host is None:
        options.tango_host = taurus.Authority().getNormalName()
    w.setTangoHost(options.tango_host)

    if len(args) == 1:
        w.setDevice(args[0])

    w.show()

    sys.exit(app.exec_())
Ejemplo n.º 4
0
def main():
    from taurus.qt.qtgui.application import TaurusApplication
    app = TaurusApplication(sys.argv, cmd_line_parser=None)
    from taurus.qt.qtgui.container import TaurusMainWindow
    form = Qt.QMainWindow()

    def kk(d):
        print(d)

    Qt.qApp.SDM = SharedDataManager(form)
    Qt.qApp.SDM.connectReader('someUID', kk)
    Qt.qApp.SDM.connectWriter('anotherUID', form, 'thisisasignalname')

    form.show()

    paneldesc, ok = PanelDescriptionWizard.getDialog(
        form,
        extraWidgets=[('PyQt4.Qt.QLineEdit', 'logos:taurus.png'),
                      ('PyQt4.Qt.QTextEdit', None)])
    if ok:
        w = paneldesc.getWidget(sdm=Qt.qApp.SDM)
        form.setCentralWidget(w)
        form.setWindowTitle(paneldesc.name)
    print(Qt.qApp.SDM.info())

    sys.exit(app.exec_())
Ejemplo n.º 5
0
    def __init__(self, name, **kw):

        self.initDone = False

        self.app = QtGui.QApplication.instance()
        if self.app is None:
            #app = QtGui.QApplication(sys.argv)
            self.app = TaurusApplication([])

        pg.setConfigOption('background', 'w')
        pg.setConfigOption('foreground', 'k')
        self.win = pg.GraphicsWindow(title="A Graphics Window")

        self.x = np.arange(0., 10., 0.1)
        self.t = np.tan(self.x)
        #
        # this is not the place for calling addPlot() since
        # we don't know how many we have to allocate
        #
        self.tan = self.win.addPlot()  # ***
        self.i = 2
        self.initDone = True
        self.call__init__(sms.BaseDoor, name, **kw)

        self.app.processEvents()
        return
Ejemplo n.º 6
0
def TaurusPanelMain():
    '''A launcher for TaurusPanel.'''
    # NOTE: DON'T PUT TEST CODE HERE.
    # THIS IS CALLED FROM THE LAUNCHER SCRIPT (<taurus>/scripts/tauruspanel)
    from taurus.qt.qtgui.application import TaurusApplication
    from taurus.core.util import argparse
    import sys

    parser = argparse.get_taurus_parser()
    parser.set_usage("%prog [options] [devname]")
    parser.set_description("Taurus Application inspired in Jive and Atk Panel")

    app = TaurusApplication(cmd_line_parser=parser,
                            app_name="tauruspanel",
                            app_version=taurus.Release.version)
    args = app.get_command_line_args()
    options = app.get_command_line_options()

    w = TaurusDevPanel()

    if options.tango_host is None:
        options.tango_host = taurus.Authority().getNormalName()
    w.setTangoHost(options.tango_host)

    if len(args) == 1:
        w.setDevice(args[0])

    w.show()

    sys.exit(app.exec_())
def _demo_ModelChooserImage():
    import sys
    from taurus.qt.qtgui.tpg import TaurusImgModelChooserTool, TaurusImageItem
    from taurus.qt.qtgui.application import TaurusApplication
    import pyqtgraph as pg

    app = TaurusApplication()

    w = pg.PlotWidget()

    img = TaurusImageItem()

    # Add taurus 2D image data
    img.setModel("eval:rand(256,256)")

    w.addItem(img)

    w.showAxis("left", show=False)
    w.showAxis("bottom", show=False)

    tool = TaurusImgModelChooserTool()
    tool.attachToPlotItem(w.getPlotItem())

    w.show()

    tool.trigger()
    sys.exit(app.exec_())
Ejemplo n.º 8
0
def main():
    """hello"""

    app = Qt.QApplication.instance()
    owns_app = app is None

    if owns_app:
        from taurus.qt.qtgui.application import TaurusApplication
        app = TaurusApplication(sys.argv, cmd_line_parser=None)

    w = Qt.QWidget()
    layout = Qt.QGridLayout()
    layout.setContentsMargins(2, 2, 2, 2)
    layout.setSpacing(2)
    w.setLayout(layout)
    for i, color in enumerate(LedColor.keys()):
        led = QLed()
        led.ledColor = color
        led.ledStatus = True
        layout.addWidget(led, i, 0)
        led = QLed()
        led.ledColor = color
        led.ledStatus = False
        layout.addWidget(led, i, 1)
        led = QLed()
        led.ledColor = color
        led.blinkingInterval = 500
        layout.addWidget(led, i, 2)
    w.show()

    if owns_app:
        sys.exit(app.exec_())
    else:
        return w
Ejemplo n.º 9
0
Archivo: alt.py Proyecto: dscran/taurus
def trend2d_cmd(model, x_axis_mode, demo, window_name, use_alt, ls_alt,
                max_buffer_size):

    # list alternatives option
    if ls_alt:
        _print_alts(EP_GROUP_TREND2D)
        sys.exit(0)

    # use alternative
    if use_alt is None:
        use_alt = getattr(_ts, "TREND2D_ALT", ".*")

    # get the selected alternative
    try:
        TTrend2D, epname = _load_class_from_group(EP_GROUP_TREND2D,
                                                  include=[use_alt])
    except:
        _print_alts(EP_GROUP_TREND2D)
        sys.exit(1)

    app = TaurusApplication(app_name="Taurus Trend 2D ({})".format(epname))
    w = TTrend2D(stackMode=x_axis_mode,
                 wintitle=window_name,
                 buffersize=max_buffer_size)

    if demo:
        model = "eval:x=linspace(0,3,40);t=rand();sin(x+t)"

    if model:
        w.setModel(model)

    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 10
0
def trend_main(
        models=(), config_file=None, demo=False,
        window_name="TaurusTrend (pg)"):
    """Launch a TaurusTrend"""
    import sys
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication(cmd_line_parser=None, app_name="taurustrend(pg)")

    w = TaurusTrend()

    w.setWindowTitle(window_name)

    if demo:
        models = list(models)
        models.extend(["eval:rand()", "eval:1+rand(2)"])

    if config_file is not None:
        w.loadConfigFile(config_file)

    if models:
        w.setModel(models)

    w.show()
    ret = app.exec_()
    # w.saveConfigFile('tmp/TaurusTrend.pck')
    # import pprint
    # pprint.pprint(w.createConfig())

    sys.exit(ret)
Ejemplo n.º 11
0
def main():
    from taurus.qt.qtgui.application import TaurusApplication
    from taurus.core.util import argparse
    import sys

    parser = argparse.get_taurus_parser()
    parser.usage = "%prog [options] <LimaCCDs device>"

    app = TaurusApplication(sys.argv,
                            cmd_line_parser=parser,
                            app_name="BeamViewer",
                            app_version="1.0")

    args = app.get_command_line_args()

    widget = BeamViewer(toolbar=True, options={'show_contrast': True})

    if len(args) < 1:
        parser.print_help()
        sys.exit(1)

    widget.setModel(args[0])
    widget.show()

    sys.exit(app.exec_())
Ejemplo n.º 12
0
def image_cmd(model, color_mode, demo, window_name):
    from taurus.qt.qtgui.application import TaurusApplication
    import sys

    app = TaurusApplication(cmd_line_parser=None,
                            app_name="Taurus Image Dialog")

    rgb_mode = (color_mode == 'rgb')

    # TODO:  is "-c rgb --demo" doing the right thing?? Check it.
    if demo:
        if color_mode == 'rgb':
            model = 'eval:randint(0,256,(10,20,3))'
        else:
            model = 'eval:rand(256,128)'

    w = TaurusImageDialog(wintitle=window_name)

    w.setRGBmode(rgb_mode)

    # set model
    if model:
        w.setModel(model)

    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 13
0
def launcherButtonMain():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication()

    # Creating button giving the widget
    # from taurus.qt.qtgui.plot import TaurusPlot
    # w = TaurusPlot()
    # form = TaurusLauncherButton(parent=None, designMode=False, widget=w,
    #                             icon='logos:taurus.png'), text='show')

    # Creating button giving the widget class name
    # form = TaurusLauncherButton(parent=None, designMode=False,
    #                             widget='TaurusPlot', icon='logos:taurus.png',
    #                             text='show')

    # Creating button using a derived class with the name widget class
    # hardcoded
    class MyButton(TaurusLauncherButton):
        _widgetClassName = 'TaurusPlot'
        _icon = 'logos:taurus.png'
        _text = 'show'
    form = MyButton()

    form.setModel('sys/tg_test/1/wave')
    form.show()
    sys.exit(app.exec_())
Ejemplo n.º 14
0
def launcherButtonMain():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication()

    # Creating button giving the widget
    # from taurus.qt.qtgui.plot import TaurusPlot
    # w = TaurusPlot()
    # form = TaurusLauncherButton(parent=None, designMode=False, widget=w,
    #                             icon='logos:taurus.png'), text='show')

    # Creating button giving the widget class name
    # form = TaurusLauncherButton(parent=None, designMode=False,
    #                             widget='TaurusPlot', icon='logos:taurus.png',
    #                             text='show')

    # Creating button using a derived class with the name widget class
    # hardcoded
    class MyButton(TaurusLauncherButton):
        _widgetClassName = 'TaurusPlot'
        _icon = 'logos:taurus.png'
        _text = 'show'
    form = MyButton()

    form.setModel('sys/tg_test/1/wave')
    form.show()
    sys.exit(app.exec_())
Ejemplo n.º 15
0
def demo3():
    '''simple demo including more than one widget'''

    import sys
    from taurus.qt.qtgui.application import TaurusApplication
    from taurus.qt.qtgui.display import TaurusLabel, TaurusLed
    from taurus.qt.qtgui.input import TaurusValueLineEdit, TaurusValueCheckBox

    app = TaurusApplication()

    w1 = TaurusReadWriteSwitcher(readWClass=TaurusLabel,
                                 writeWClass=TaurusValueLineEdit)
    w1.model = "sys/tg_test/1/long_scalar"

    w2 = TaurusReadWriteSwitcher(readWClass=TaurusLed,
                                 writeWClass=TaurusValueCheckBox)
    w2.model = "sys/tg_test/1/boolean_scalar"

    f = Qt.QWidget()
    f.setLayout(Qt.QVBoxLayout())
    f.layout().addWidget(w1)
    f.layout().addWidget(w2)
    f.layout().addWidget(
        TaurusReadWriteSwitcher())  # add non-initialized switcher
    f.show()

    sys.exit(app.exec_())
Ejemplo n.º 16
0
def main():

    from taurus.qt.qtgui.application import TaurusApplication
    import sys

    from taurus.core.util.argparse import get_taurus_parser

    parser = get_taurus_parser()
    parser.set_usage("python showscanonline.py [door_name]")
    app = TaurusApplication(app_name='Showscan Online',
                            org_domain="Sardana",
                            org_name="Tango communinity",
                            cmd_line_parser=parser)

    gui = TaurusGuiLite()
    args = app.get_command_line_args()

    if len(args) < 1:
        parser.print_help(sys.stderr)
        sys.exit(1)

    door_name = args[0]
    widget = ShowScanOnline(gui)
    widget.setModel(door_name)
    gui.show()
    sys.exit(app.exec_())
Ejemplo n.º 17
0
def test1():
    '''tests taurusForm'''
    import sys
    if len(sys.argv) > 1:
        models = sys.argv[1:]
    else:
        models = None
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication(sys.argv)
    if models is None:
        models = ['sys/tg_test/1/state',
                  'sys/tg_test/1/float_scalar',
                  'sys/tg_test/1/boolean_image',
                  'sys/tg_test/1/float_spectrum',
                  'sys/tg_test/1/status']
    dialog = TaurusForm()
    dialog.setModel(models)
    dialog.setModifiableByUser(True)
    for i, tv in enumerate(dialog.getItems()):
        tv.setDangerMessage("Booooo scaring %d!!!" % i)
    dialog.show()

    dialog2 = TaurusForm()
    dialog2.show()
    dialog2.setModifiableByUser(True)
    sys.exit(app.exec_())
Ejemplo n.º 18
0
def jdraw_view_main():
    import sys
    import time
    import taurus.qt.qtgui.graphic
    taurus.setLogLevel(taurus.Info)
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication(sys.argv)

    #form = Qt.QDialog()
    # ly=Qt.QVBoxLayout(form)
    # container=Qt.QWidget()
    # ly.addWidget(container)
    # for m in sys.argv[1:]:
    #tv=TaurusJDrawSynopticsView(container, designMode=False)
    # tv.setModel(m)
    form = taurus.qt.qtgui.graphic.TaurusJDrawSynopticsView(designMode=False)
    form.show()
    # print '%s setModel(%s)'%(time.ctime(),sys.argv[1])
    form.setModel(sys.argv[1])
    form.setWindowTitle(sys.argv[1].rsplit('.', 1)[0])
    #def kk(*args):print("\tgraphicItemSelected(%s)"%str(args))
    #form.connect(form,Qt.SIGNAL("graphicItemSelected(QString)"), kk)
    # form.fitting()
    sys.exit(app.exec_())
Ejemplo n.º 19
0
def test4():
    '''tests customwidgetma in taurusforms'''
    import sys
    from taurus.qt.qtgui.display import TaurusLabel
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication(sys.argv)

    from taurus.qt.qtgui.panel import TaurusValue

    class DummyCW(TaurusValue):

        def setModel(self, model):
            print("!!!!! IN DUMMYCW.SETMODEL", model)
            TaurusValue.setModel(self, model + '/double_scalar')

    models = ['sys/database/2', 'sys/tg_test/1', 'sys/tg_test/1/short_spectrum',
              'sys/tg_test/1/state', 'sys/tg_test/1/short_scalar_ro']
    models.append('tango://controls02:10000/expchan/bl97_simucotictrl_1/1')
    map = {
        # taurusvalue-like classes given as strings
        'PseudoCounter': ('taurus.qt.qtgui.extra_pool.PoolChannelTV', (), {}),
        'CTExpChannel': ('taurus.qt.qtgui.extra_pool.PoolChannelTV', (), {}),
        'ZeroDExpChannel': ('taurus.qt.qtgui.extra_pool.PoolChannelTV', (), {}),
        'OneDExpChannel': ('taurus.qt.qtgui.extra_pool.PoolChannelTV', (), {}),
        'TwoDExpChannel': ('taurus.qt.qtgui.extra_pool.PoolChannelTV', (), {}),
        # a TaurusValue-like class given as a class (old way)
        'TangoTest': DummyCW,
        'DataBase': TaurusLabel}  # a non-TaurusValue-like class given as a class (old way)

    dialog = TaurusForm()
    dialog.setCustomWidgetMap(map)
    dialog.setModel(models)
    dialog.show()
    sys.exit(app.exec_())
Ejemplo n.º 20
0
def taurusCurveDlgMain():
    from taurus.qt.qtgui.application import TaurusApplication
    from taurus.qt.qtgui.extra_guiqwt.tools import TimeAxisTool
    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 1D data sets")
    parser.add_option("--demo", action="store_true", dest="demo",
                      default=False, help="show a demo of the widget")
    parser.add_option("--window-name", dest="window_name",
                      default="Taurus Curve Dialog", help="Name of the window")
    app = TaurusApplication(
        cmd_line_parser=parser, app_name="Taurus Curve Dialog", app_version=taurus.Release.version)
    args = app.get_command_line_args()
    options = app.get_command_line_options()

    # check & process options
    if options.demo:
        args.append('eval:rand(128)')

    w = TaurusCurveDialog(edit=False, wintitle=options.window_name)

    w.add_tool(TimeAxisTool)

    # set model
    if len(args) > 0:
        w.setModel(args)
    else:
        parser.print_help(sys.stderr)
        sys.exit(1)

    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 21
0
def TaurusPanelMain():
    """A launcher for TaurusPanel."""

    from taurus.qt.qtgui.panel import TaurusDevPanel

    parser = argparse.get_taurus_parser()
    parser.set_usage("%prog [options] [devname]")
    parser.set_description("Taurus Application inspired in Jive and Atk Panel")

    app = TaurusApplication(cmd_line_parser=parser,
                            app_name="tauruspanel",
                            app_version=Release.version)
    args = app.get_command_line_args()
    options = app.get_command_line_options()

    w = TaurusDevPanel()

    if options.tango_host is None:
        options.tango_host = taurus.Authority().getNormalName()
    w.setTangoHost(options.tango_host)

    if len(args) == 1:
        w.setDevice(args[0])

    w.show()

    sys.exit(app.exec_())
Ejemplo n.º 22
0
Archivo: curve.py Proyecto: cmft/taurus
def taurusTrendMain():
    from taurus.qt.qtgui.extra_guiqwt.builder import make
    from taurus.qt.qtgui.application import TaurusApplication
    from guiqwt.plot import CurveDialog
    from guiqwt.tools import HRangeTool
    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 1D data sets")
    parser.add_option("-x", "--x-axis-mode", dest="x_axis_mode", default='d', metavar="t|d|e",
                      help="interpret X values as timestamps (t), time deltas (d) or event numbers (e). Accepted values: t|d|e")
    parser.add_option("-b", "--buffer", dest="max_buffer_size", default='16384',
                      help="maximum number of values to be plotted (when reached, the oldest values will be discarded)")
    parser.add_option("-a", "--use-archiving",
                      action="store_true", dest="use_archiving", default=False)
    parser.add_option("--demo", action="store_true", dest="demo",
                      default=False, help="show a demo of the widget")
    app = TaurusApplication(
        cmd_line_parser=parser, app_name="taurusplot2", app_version=taurus.Release.version)
    args = app.get_command_line_args()
    options = app.get_command_line_options()

    # check & process options
    stackModeMap = dict(t='datetime', d='deltatime', e='event')
    if options.x_axis_mode.lower() not in stackModeMap:
        parser.print_help(sys.stderr)
        sys.exit(1)

    stackMode = stackModeMap[options.x_axis_mode.lower()]

    if options.demo:
        args.append('eval:rand()')

    w = CurveDialog(edit=False, toolbar=True, wintitle="Taurus Trend")

    # set archiving
    if options.use_archiving:
        raise NotImplementedError('Archiving support is not yet implemented')
        w.setUseArchiving(True)

    w.add_tool(HRangeTool)
    # w.add_tool(TaurusCurveChooserTool)
    # w.add_tool(TimeAxisTool)

    if len(args) == 0:
        parser.print_help(sys.stderr)
        sys.exit(1)

    plot = w.get_plot()
    for a in args:
        item = TaurusTrendItem(stackMode=stackMode,
                               buffersize=int(options.max_buffer_size))
        plot.add_item(item)
        item.setModel(a)

    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 23
0
def taurusTrendMain():
    from taurus.qt.qtgui.extra_guiqwt.builder import make
    from taurus.qt.qtgui.application import TaurusApplication
    from guiqwt.plot import CurveDialog
    from guiqwt.tools import HRangeTool
    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 1D data sets")
    parser.add_option("-x", "--x-axis-mode", dest="x_axis_mode", default='d', metavar="t|d|e",
                      help="interpret X values as timestamps (t), time deltas (d) or event numbers (e). Accepted values: t|d|e")
    parser.add_option("-b", "--buffer", dest="max_buffer_size", default='16384',
                      help="maximum number of values to be plotted (when reached, the oldest values will be discarded)")
    parser.add_option("-a", "--use-archiving",
                      action="store_true", dest="use_archiving", default=False)
    parser.add_option("--demo", action="store_true", dest="demo",
                      default=False, help="show a demo of the widget")
    app = TaurusApplication(
        cmd_line_parser=parser, app_name="taurusplot2", app_version=taurus.Release.version)
    args = app.get_command_line_args()
    options = app.get_command_line_options()

    # check & process options
    stackModeMap = dict(t='datetime', d='deltatime', e='event')
    if options.x_axis_mode.lower() not in stackModeMap:
        parser.print_help(sys.stderr)
        sys.exit(1)

    stackMode = stackModeMap[options.x_axis_mode.lower()]

    if options.demo:
        args.append('eval:rand()')

    w = CurveDialog(edit=False, toolbar=True, wintitle="Taurus Trend")

    # set archiving
    if options.use_archiving:
        raise NotImplementedError('Archiving support is not yet implemented')
        w.setUseArchiving(True)

    w.add_tool(HRangeTool)
    # w.add_tool(TaurusCurveChooserTool)
    # w.add_tool(TimeAxisTool)

    if len(args) == 0:
        parser.print_help(sys.stderr)
        sys.exit(1)

    plot = w.get_plot()
    for a in args:
        item = TaurusTrendItem(stackMode=stackMode,
                               buffersize=int(options.max_buffer_size))
        plot.add_item(item)
        item.setModel(a)

    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 24
0
def testWidget():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication(sys.argv)
    w = GraphicalChoiceWidget(None, True)
    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 25
0
def demo_cmd():
    """A demo application for taurus"""
    from taurus.qt.qtgui.application import TaurusApplication
    app = TaurusApplication(cmd_line_parser=None)
    gui = TaurusDemoPanel()
    gui.setWindowTitle('Taurus demo')
    gui.show()
    sys.exit(app.exec_())
Ejemplo n.º 26
0
def main():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication(sys.argv, cmd_line_parser=None)
    w = QLogo()
    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 27
0
 def run(models, t0, t1):
     app = TaurusApplication(app_name='tpgArchiving')
     gui = ArchivingWidget()
     #gui.setTimes(args[1],args[2])
     #gui.setModel(args[0])
     gui.show()
     gui.addXYModelsSig.emit(list(models), t0, t1)
     app.exec_()
Ejemplo n.º 28
0
def icons_cmd():
    """Show the Taurus icon catalog"""
    import sys
    app = TaurusApplication(cmd_line_parser=None)
    w = QIconCatalog()
    w.setWindowTitle('Taurus Icon Catalog')
    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 29
0
def main():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication(sys.argv)
    w = MAXValueBar()
    w.setModel(sys.argv[1])
    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 30
0
def main():
    """launcher of QIconCatalog"""
    import sys
    from taurus import Release
    app = TaurusApplication(app_version=Release.version)
    w = QIconCatalog()
    w.setWindowTitle('Taurus Icon Catalog')
    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 31
0
def main():
    """launcher of QIconCatalog"""
    import sys
    from taurus import Release
    app = TaurusApplication(app_version=Release.version)
    w = QIconCatalog()
    w.setWindowTitle('Taurus Icon Catalog')
    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 32
0
def taurusTrendDlgMain():
    from taurus.qt.qtgui.application import TaurusApplication
    import taurus.core
    import sys

    # prepare options
    parser = taurus.core.util.argparse.get_taurus_parser()
    parser.set_usage("%prog [options] <model>")
    parser.set_description(
        'a Taurus application for plotting trends of scalars')
    parser.add_option("-x", "--x-axis-mode", dest="x_axis_mode", default='t', metavar="t|d|e",
                      help="interpret X values as timestamps (t), time deltas (d) or event numbers (e). Accepted values: t|d|e")
    parser.add_option("-b", "--buffer", dest="max_buffer_size", default='10000',
                      help="maximum number of values to be plotted (when reached, the oldest values will be discarded)")
    parser.add_option("-a", "--use-archiving",
                      action="store_true", dest="use_archiving", default=False)
    parser.add_option("--demo", action="store_true", dest="demo",
                      default=False, help="show a demo of the widget")
    parser.add_option("--window-name", dest="window_name",
                      default="Taurus Trend", help="Name of the window")
    app = TaurusApplication(
        cmd_line_parser=parser, app_name="Taurus Trend", app_version=taurus.Release.version)
    args = app.get_command_line_args()
    options = app.get_command_line_options()

    # check & process options
    stackModeMap = dict(t='datetime', d='deltatime', e='event')
    if options.x_axis_mode.lower() not in stackModeMap:
        parser.print_help(sys.stderr)
        sys.exit(1)

    stackMode = stackModeMap[options.x_axis_mode.lower()]

    if options.use_archiving:
        raise NotImplementedError('Archiving support is not yet implemented')

    if options.demo:
        args.append('eval:rand()')

    taurusparam = TaurusTrendParam()
    taurusparam.stackMode = stackMode
    taurusparam.maxBufferSize = int(options.max_buffer_size)
    taurusparam.useArchiving = options.use_archiving

    w = TaurusTrendDialog(wintitle=options.window_name,
                          taurusparam=taurusparam)

    # set model
    if len(args) > 0:
        w.setModel(args)
    else:
        parser.print_help(sys.stderr)
        sys.exit(1)

    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 33
0
def main():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication()
    # model = ''
    panel = BaseLLRFWidget()
    panel.show()

    sys.exit(app.exec_())
def main():
    app = TaurusApplication()
    motors_list = ['motor/motctrl01/1',
                   'motor/motctrl01/2',
                   'motor/motctrl01/3',
                   'motor/motctrl01/4']
    main_window = UiMainWindow(motors_list)
    main_window.setWindowTitle('OperatorGUI')
    main_window.show()
    sys.exit(app.exec_())
def main():
    app = TaurusApplication()
    motors_list = [
        'motor/motctrl01/1', 'motor/motctrl01/2', 'motor/motctrl01/3',
        'motor/motctrl01/4'
    ]
    main_window = UiMainWindow(motors_list)
    main_window.setWindowTitle('OperatorGUI')
    main_window.show()
    sys.exit(app.exec_())
Ejemplo n.º 36
0
def main():
    from taurus.core.util import argparse
    from taurus.qt.qtgui.application import TaurusApplication

    parser = argparse.get_taurus_parser()
    parser.set_usage("%prog [options]")
    parser.set_description("Sardana macro sequencer.\n"
                           "It allows the creation of sequences of "
                           "macros, executed one after the other.\n"
                           "The sequences can be stored under xml files")
    parser.add_option("-f",
                      "--file",
                      dest="file",
                      default=None,
                      help="load an xml macro sequence file")

    app = TaurusApplication(cmd_line_parser=parser,
                            app_name="sequencer",
                            app_version=sardana.Release.version)
    args = app.get_command_line_args()
    options = app.get_command_line_options()

    app.setOrganizationName(globals.ORGANIZATION_NAME)
    app.setApplicationName(globals.SEQUENCER_APPLICATION_NAME)
    sequencer = createSequencer(args, options)
    sequencer.show()
    sys.exit(app.exec_())
Ejemplo n.º 37
0
Archivo: alt.py Proyecto: dscran/taurus
def plot_cmd(models, config_file, x_axis_mode, demo, window_name, use_alt,
             ls_alt):
    """Shows a plot for the given models"""

    if ls_alt:
        _print_alts(EP_GROUP_PLOT)
        sys.exit(0)

    if use_alt is None:
        use_alt = getattr(_ts, "PLOT_ALT", ".*")

    try:
        TPlot, epname = _load_class_from_group(EP_GROUP_PLOT,
                                               include=[use_alt])
    except:
        _print_alts(EP_GROUP_PLOT)
        sys.exit(1)

    app = TaurusApplication(app_name="taurusplot({})".format(epname))

    w = TPlot()
    w.setWindowTitle(window_name)

    if demo:
        models = list(models)
        models.extend(["eval:rand(100)", "eval:0.5*sqrt(arange(100))"])

    try:
        w.setXAxisMode(x_axis_mode)
    except Exception as e:
        warning(
            'Could not set X axis mode to "%s" on %s plot. Reason: "%s"',
            x_axis_mode,
            epname,
            e,
        )
        sys.exit(1)

    if config_file is not None:
        try:
            w.loadConfigFile(config_file)
        except Exception as e:
            warning(
                'Could not load config file "%s" on %s plot. Reason: "%s"',
                config_file,
                epname,
                e,
            )
            sys.exit(1)

    if models:
        w.setModel(models)

    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 38
0
def main():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication()
    model = 'ws/rf/pynutaq_1'
    panel = IqLoopsSettings()
    panel.setModel(model)
    panel.show()

    sys.exit(app.exec_())
Ejemplo n.º 39
0
def main():
    from taurus.qt.qtgui.application import TaurusApplication
    app = TaurusApplication()

    w = build_gui()
    tree = TreeQObjectWidget(qobject_root=w)
    tree.show()
    #import pprint
    # pprint.pprint(get_qobject_tree_str())
    w.dumpObjectTree()
    app.exec_()
Ejemplo n.º 40
0
def main():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication()
    model = ['ws/rf/pynutaq_1', 'ws/rf/pynutaqdiags_1']
    panel = FpgaVersion()
    panel.setModel(model)
    panel.show()

    sys.exit(app.exec_())
Ejemplo n.º 41
0
def create_application(name, parser):
    """
    Create the application and return an (application, taurusgui) tuple.

    :return: Tuple compose by a TaurusApplication and a TaurusGUI
    :rtype: tuple
    """
    app = TaurusApplication(app_name=name, cmd_line_parser=parser)
    app.setOrganizationName(ORGANIZATION)
    gui = TaurusGui()
    return app, gui
Ejemplo n.º 42
0
def _test2():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication
    from taurus.qt.qtgui.display import TaurusLabel
    app = TaurusApplication()

    tl = TaurusLabel()
    tl.setModel(ATTR_IPAP_POS)
    tl.show()

    sys.exit(app.exec_())
def main():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication()
    model = 'ws/rf/llrfdiags_1'
    panel = ItckOutDiagSimple()
    panel.setModel(model)
    panel.show()

    sys.exit(app.exec_())
Ejemplo n.º 44
0
def main():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication()
    model = ['ws/rf/llrf-1', 'ws/rf/llrfdiags_1']
    panel = LlrfSimple()
    panel.setModel(model)
    panel.show()

    sys.exit(app.exec_())
Ejemplo n.º 45
0
def main():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication()
    model = 'ws/rf/pynutaq_1'
    panel = AutoTuningSimple()
    panel.setModel(model)
    panel.show()

    sys.exit(app.exec_())
Ejemplo n.º 46
0
def main():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication()
    model = "ws/rf/pynutaq_1"
    panel = PolarDiag()
    panel.setModel(model)
    panel.show()

    sys.exit(app.exec_())
Ejemplo n.º 47
0
def main():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication()
    model = 'ws/rf/pynutaqdiags_1'
    panel = Landau()
    panel.setModel(model)
    panel.show()

    sys.exit(app.exec_())
Ejemplo n.º 48
0
def _taurusAttrListTest():
    """tests taurusAttrList. Model: an attribute containing a list of strings"""
    from taurus.qt.qtgui.application import TaurusApplication
    a = TaurusApplication()
    # model = sys.argv[1]
    # model = "eval:['foo','bar']"
    model = "sys/tg_test/1/string_spectrum"
    w = TaurusAttrListComboBox()
    w.setModel(model)
    w.show()
    return a.exec_()
def main():

    parser = OptionParser("usage: %prog [options] SVGFILE")
    parser.add_option("-s", "--size", dest="size",
                      help="Window size on form WIDTH,HEIGHT", metavar="WINSIZE")
    parser.add_option("-t", "--title", dest="title",
                      help="Window title", metavar="WINTITLE")
    parser.add_option("-z", "--zoomsteps", dest="zoomsteps", metavar="ZOOMSTEPS",
                      help="Zoom levels, on form ZOOM1,ZOOM2,...", default="1")

    app = TaurusApplication(cmd_line_parser=parser)

    args = app.get_command_line_args()
    if len(args) != 1:
        sys.exit("You need to specify the SVG file to load!")
    svg = args[0]
    options = app.get_command_line_options()

    widget = TaurusSynopticWidget()

    # We'd like the synoptic to "select" the relevant item when
    # the user focuses on a panel. Let's connect a handler to
    # the focusChanged signal that does this.
    def onfocus(old, new):
        if new and hasattr(new, "window"):
            for device, panel in widget._panels.items():
                if panel == new.window():
                    widget.select("model", [device])
    app.focusChanged.connect(onfocus)

    # need absolute path to the SVG file
    svgfile = os.path.abspath(svg)

    # since the svg currently needs to be hardcoded in the HTML, we
    # create a temporary HTML file from a static template.
    path = os.path.dirname(__file__)
    template = os.path.join(path, "web", "template.html")
    with open(template) as f:
        tmpl = Template(f.read())
    zoomsteps = [int(z) for z in options.zoomsteps.split(",")]
    config = {"view": {"zoomSteps": zoomsteps}}
    html = tmpl.substitute(path="/web", svgfile=svgfile, config=json.dumps(config))
    with NamedTemporaryFile(suffix=".html") as tf:
        tf.write(html)
        tf.flush()
        widget.setModel(tf.name)
        if options.size:
            w, h = options.size.split(",")
            widget.resize(int(w), int(h))

        widget.setWindowTitle(options.title or os.path.basename(svg))
        widget.show()
        app.exec_()
Ejemplo n.º 50
0
Archivo: image.py Proyecto: cmft/taurus
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_()
Ejemplo n.º 51
0
def main():
    from taurus.core.util import argparse
    from taurus.qt.qtgui.application import TaurusApplication

    parser = argparse.get_taurus_parser()
    parser.set_usage("%prog [options]")
    parser.set_description("Sardana macro sequencer.\n"
                           "It allows the creation of sequences of "
                           "macros, executed one after the other.\n"
                           "The sequences can be stored under xml files")
    parser.add_option("-f", "--file",
                      dest="file", default=None,
                      help="load an xml macro sequence file")

    app = TaurusApplication(cmd_line_parser=parser,
                            app_name="sequencer",
                            app_version=sardana.Release.version)
    args = app.get_command_line_args()
    options = app.get_command_line_options()

    app.setOrganizationName(globals.ORGANIZATION_NAME)
    app.setApplicationName(globals.SEQUENCER_APPLICATION_NAME)
    sequencer = createSequencer(args, options)
    sequencer.show()
    sys.exit(app.exec_())
Ejemplo n.º 52
0
def demo1():
    '''Simple demo'''
    import sys
    from taurus.qt.qtgui.application import TaurusApplication
    from taurus.qt.qtgui.display import TaurusLabel
    from taurus.qt.qtgui.input import TaurusValueLineEdit

    app = TaurusApplication()

    w = TaurusReadWriteSwitcher(readWClass=TaurusLabel,
                                writeWClass=TaurusValueLineEdit)
    w.model = "sys/tg_test/1/long_scalar"

    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 53
0
def test2():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication
    from taurus.qt.qtgui.display import TaurusLabel

    app = TaurusApplication()

    w = TaurusLabel()
    # calculates free space in Mb
    attrname = 'eval:@taurus.core.evaluation.dev_example.FreeSpaceDevice/getFreeSpace("/")'

    w.setModel(attrname)

    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 54
0
def commandButtonMain():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication()
    form = TaurusCommandButton(parent=None, designMode=False, command='DevBoolean', parameters=[
                               123], icon='logos:taurus.png', text='launch: DevBoolean 123')
    form.setModel('sys/tg_test/1')
    form.setDangerMessage(
        'Booo scary command!!\n Maybe you should think twice!')

    def f(*a):
        print a
    form.commandExecuted.connect(f)
    form.show()
    sys.exit(app.exec_())
Ejemplo n.º 55
0
def test():
    import sys, taurus, time
    from  taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication(sys.argv)

    favouritesEditor = FavouritesMacrosEditor()

    args = app.get_command_line_args()
    favouritesEditor.setModel(args[0])
    time.sleep(1)
    macroNode = favouritesEditor.getModelObj().getMacroNodeObj(str(args[1]))
    favouritesEditor.addMacro(macroNode)
    favouritesEditor.show()

    sys.exit(app.exec_())
Ejemplo n.º 56
0
def test():
    import sys, taurus, time
    from  taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication(sys.argv)

    historyViewer = HistoryMacrosViewer()

    args = app.get_command_line_args()
    historyViewer.setModel(args[0])
    time.sleep(1)
    macroNode = historyViewer.getModelObj().getMacroNodeObj(str(args[1]))
    historyViewer.addMacro(macroNode)
    historyViewer.show()

    sys.exit(app.exec_())
Ejemplo n.º 57
0
def main():
    from taurus.qt.qtgui.application import TaurusApplication
    
    app = TaurusApplication([])
    
    @UILoadable(with_ui="ui")
    class A(Qt.QWidget):

        def __init__(self, parent=None):
            Qt.QWidget.__init__(self, parent)
            import taurus.qt.qtgui.panel.ui
            path = os.path.dirname(taurus.qt.qtgui.panel.ui.__file__)
            self.loadUi(filename='TaurusMessagePanel.ui', path=path)
    
    gui = A()
    gui.show()
    app.exec_()
Ejemplo n.º 58
0
Archivo: curve.py Proyecto: cmft/taurus
def taurusCurveMain():
    from taurus.qt.qtgui.extra_guiqwt.builder import make
    from taurus.qt.qtgui.application import TaurusApplication
    from guiqwt.plot import CurveDialog
    from guiqwt.tools import HRangeTool
    from taurus.qt.qtgui.extra_guiqwt.tools import TaurusCurveChooserTool, TimeAxisTool
    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 1D data sets")
    app = TaurusApplication(
        cmd_line_parser=parser, app_name="taurusplot2", app_version=taurus.Release.version)
    args = app.get_command_line_args()

    win = CurveDialog(edit=False, toolbar=True, wintitle="TaurusPlot2",
                      options=dict(title="", xlabel="xlabel", ylabel="ylabel"))
    win.add_tool(HRangeTool)
    win.add_tool(TaurusCurveChooserTool)
    win.add_tool(TimeAxisTool)

    plot = win.get_plot()

    for a in args:
        mx_my = a.split('|')
        n = len(mx_my)
        if n == 1:
            mx, my = None, mx_my[0]
        elif n == 2:
            mx, my = mx_my
        else:
            print "Invalid model: %s\n" % mx_my
            parser.print_help(sys.stderr)
            sys.exit(1)
        # cycle colors
        style = make.style.next()
        color = style[0]
        linestyle = style[1:]
        plot.add_item(make.curve(mx, my, color=color,
                                 linestyle=linestyle, linewidth=2))

    win.get_itemlist_panel().show()
    plot.set_items_readonly(False)
    win.show()
    win.exec_()
Ejemplo n.º 59
0
def main():
    import sys
    from taurus.qt.qtgui.application import TaurusApplication

    app = TaurusApplication()

    form = Qt.QWidget()
    layout = Qt.QVBoxLayout()
    form.setLayout(layout)
    for m in ('sys/tg_test/1/double_scalar',
              'sys/tg_test/1/double_scalar'
              ):
        w = TaurusValueLineEdit()
        w.setModel(m)
        layout.addWidget(w)
    form.show()
    sys.exit(app.exec_())
Ejemplo n.º 60
0
def _taurusValueComboboxTest():
    from taurus.qt.qtgui.application import TaurusApplication
    """tests TaurusValueCombobox """
    # model = sys.argv[1]
    model = 'sys/tg_test/1/short_scalar'
    names = [
        ('name0', 0),
        ('name1', 1),
        ('name2', 2),
        ('name3', 3)
    ]
    a = TaurusApplication()
    w = TaurusValueComboBox()
    w.setModel(model)
    w.addValueNames(names)
    #w.autoApply = True
    w.show()
    return a.exec_()