当前位置: 首页>>代码示例>>Python>>正文


Python TaurusApplication.get_command_line_options方法代码示例

本文整理汇总了Python中taurus.qt.qtgui.application.TaurusApplication.get_command_line_options方法的典型用法代码示例。如果您正苦于以下问题:Python TaurusApplication.get_command_line_options方法的具体用法?Python TaurusApplication.get_command_line_options怎么用?Python TaurusApplication.get_command_line_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在taurus.qt.qtgui.application.TaurusApplication的用法示例。


在下文中一共展示了TaurusApplication.get_command_line_options方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TaurusPanelMain

# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_options [as 别名]
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_())
开发者ID:cmft,项目名称:taurus,代码行数:31,代码来源:taurusdevicepanel.py

示例2: main

# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_options [as 别名]
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_())
开发者ID:rhomspuron,项目名称:sardana,代码行数:27,代码来源:sequenceeditor.py

示例3: taurusTrendMain

# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_options [as 别名]
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_())
开发者ID:cmft,项目名称:taurus,代码行数:61,代码来源:curve.py

示例4: main

# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_options [as 别名]
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_()
开发者ID:MaxIV-KitsControls,项目名称:lib-maxiv-svgsynoptic,代码行数:55,代码来源:__main__.py

示例5: TaurusDevicePanelMain

# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_options [as 别名]
def TaurusDevicePanelMain():
    '''A launcher for TaurusDevicePanel.'''
    import sys
    from taurus.qt.qtgui.application import TaurusApplication
    from taurus.core.util import argparse

    parser = argparse.get_taurus_parser()
    parser.set_usage("%prog [options] [devname [attrs]]")
    parser.set_description("Taurus Application inspired in Jive and Atk Panel")
    parser.add_option("", "--config-file", dest="config_file", default=None,
                      help="load a config file (TODO: document this option)")

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

    w = TaurusDevicePanel()
    w.show()

    if len(args) == 0:
        from taurus.qt.qtgui.panel import TaurusModelChooser
        models, ok = TaurusModelChooser.modelChooserDlg(w,
                                                        selectables=[
                                                            TaurusElementType.Member],
                                                        singleModel=True)
        model = models[0] if ok and models else None
        filters = ''
    else:
        model = args[0]
        filters = args[1:]

    if options.config_file is not None:
        w.loadConfigFile(options.config_file)
    elif model and filters:
        w.setAttributeFilters({model: filters})

    w.setModel(model)

    sys.exit(app.exec_())
开发者ID:cmft,项目名称:taurus,代码行数:42,代码来源:taurusdevicepanel.py

示例6: taurusFormMain

# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_options [as 别名]
def taurusFormMain():
    '''A launcher for TaurusForm.'''
    # NOTE: DON'T PUT TEST CODE HERE.
    # THIS IS CALLED FROM THE LAUNCHER SCRIPT (<taurus>/scripts/taurusform)
    # USE test1() instead.
    from taurus.qt.qtgui.application import TaurusApplication
    from taurus.core.util import argparse
    import sys
    import os

    parser = argparse.get_taurus_parser()
    parser.set_usage("%prog [options] [model1 [model2 ...]]")
    parser.set_description("the taurus form panel application")
    parser.add_option("--window-name", dest="window_name",
                      default="TaurusForm", help="Name of the window")
    parser.add_option("--config", "--config-file", dest="config_file", default=None,
                      help="use the given config file for initialization")
    app = TaurusApplication(cmd_line_parser=parser,
                            app_name="taurusform",
                            app_version=taurus.Release.version)
    args = app.get_command_line_args()
    options = app.get_command_line_options()

    dialog = TaurusForm()
    dialog.setModifiableByUser(True)
    dialog.setModelInConfig(True)
    dialog.setWindowTitle(options.window_name)

    # Make sure the window size and position are restored
    dialog.registerConfigProperty(dialog.saveGeometry, dialog.restoreGeometry,
                                  'MainWindowGeometry')

    quitApplicationAction = Qt.QAction(
        Qt.QIcon.fromTheme("process-stop"), 'Close Form', dialog)
    quitApplicationAction.triggered[()].connect(dialog.close)

    saveConfigAction = Qt.QAction("Save current settings...", dialog)
    saveConfigAction.setShortcut(Qt.QKeySequence.Save)
    saveConfigAction.triggered[()].connect(dialog.saveConfigFile)

    loadConfigAction = Qt.QAction("&Retrieve saved settings...", dialog)
    loadConfigAction.setShortcut(Qt.QKeySequence.Open)
    loadConfigAction.triggered[()].connect(dialog.loadConfigFile)

    dialog.addActions(
        (saveConfigAction, loadConfigAction, quitApplicationAction))

    # set the default map for this installation
    from taurus import tauruscustomsettings
    dialog.setCustomWidgetMap(
        getattr(tauruscustomsettings, 'T_FORM_CUSTOM_WIDGET_MAP', {}))

    # set a model list from the command line or launch the chooser
    if options.config_file is not None:
        dialog.loadConfigFile(options.config_file)
    elif len(args) > 0:
        models = args
        dialog.setModel(models)
    else:
        dialog.chooseModels()

    dialog.show()

    sys.exit(app.exec_())
开发者ID:cmft,项目名称:taurus,代码行数:66,代码来源:taurusform.py

示例7: taurusTrend2DMain

# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_options [as 别名]
def taurusTrend2DMain():
    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 ' +
                           'arrays (aka "spectrograms")')
    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='512',
                      help=("maximum number of values to be stacked " +
                            "(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 2D", help="Name of the window")

    app = TaurusApplication(cmd_line_parser=parser, app_name="Taurus Trend 2D",
                            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:x=linspace(0,3,40);t=rand();sin(x+t)')

    w = TaurusTrend2DDialog(stackMode=stackMode, wintitle=options.window_name,
                            buffersize=int(options.max_buffer_size))

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

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

    w.show()
    sys.exit(app.exec_())
开发者ID:cmft,项目名称:taurus,代码行数:63,代码来源:taurustrend2d.py


注:本文中的taurus.qt.qtgui.application.TaurusApplication.get_command_line_options方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。