本文整理汇总了Python中taurus.qt.qtgui.application.TaurusApplication.get_command_line_args方法的典型用法代码示例。如果您正苦于以下问题:Python TaurusApplication.get_command_line_args方法的具体用法?Python TaurusApplication.get_command_line_args怎么用?Python TaurusApplication.get_command_line_args使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类taurus.qt.qtgui.application.TaurusApplication
的用法示例。
在下文中一共展示了TaurusApplication.get_command_line_args方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_args [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_())
示例2: TaurusPanelMain
# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_args [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_())
示例3: taurusTrendMain
# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_args [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_())
示例4: main
# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_args [as 别名]
def main():
from taurus.qt.qtgui.application import TaurusApplication
import taurus
app = TaurusApplication(sys.argv, app_version=sardana.Release.version)
args = app.get_command_line_args()
app.setOrganizationName("Taurus")
app.setApplicationName("macroexecutor")
macroExecutor = createMacroExecutor(args)
macroExecutor.show()
sys.exit(app.exec_())
示例5: main
# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_args [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_()
示例6: taurusImageMain
# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_args [as 别名]
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_()
示例7: test
# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_args [as 别名]
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_())
示例8: test
# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_args [as 别名]
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_())
示例9: taurusCurveMain
# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_args [as 别名]
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_()
示例10: main
# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_args [as 别名]
def main():
from taurus.qt.qtgui.application import TaurusApplication
from taurus.core.util import argparse
from taurus import Release
import sys
parser = argparse.get_taurus_parser()
parser.set_usage("%prog [options] [INIFILENAME]")
parser.set_description("taurus configuration editor")
app = TaurusApplication(cmd_line_parser=parser,
app_name="taurusconfigeditor",
app_version=Release.version)
args = app.get_command_line_args()
w = QConfigEditor()
w.setMinimumSize(500, 500)
w.show()
if len(args) == 1:
w.loadFile(args[0])
sys.exit(app.exec_())
示例11: TaurusDevicePanelMain
# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_args [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_())
示例12: taurusTableMain
# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_args [as 别名]
def taurusTableMain():
'''A launcher for TaurusValuesTable.'''
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] [model]]")
parser.set_description(
"A table for viewing and editing 1D and 2D attribute values")
app = TaurusApplication(cmd_line_parser=parser,
app_name="TaurusValuesTable",
app_version=taurus.Release.version)
args = app.get_command_line_args()
dialog = TaurusValuesTable()
dialog.setModifiableByUser(True)
dialog.setWindowTitle(app.applicationName())
# set a model list from the command line or launch the chooser
if len(args) == 1:
model = args[0]
dialog.setModel(model)
else:
dialog.chooseModel()
#model = 'sys/tg_test/1/boolean_spectrum'
# model = 'sys/tg_test/1/boolean_image'
# model = 'sys/tg_test/1/string_spectrum'
# model = 'sys/tg_test/1/float_image'
# model = 'sys/tg_test/1/double_image'
# model = 'sys/tg_test/1/double_image_ro'
# model = 'sys/tg_test/1/wave'
# dialog.setModel(model)
dialog.show()
sys.exit(app.exec_())
示例13: main
# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_args [as 别名]
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] [hostname]"
app = TaurusApplication(cmd_line_parser=parser)
args = app.get_command_line_args()
if len(args) > 0:
host = args[0]
else:
host = taurus.Authority().getNormalName()
w = TaurusFilterPanel()
w.setWindowIcon(Qt.QIcon(":/actions/system-shutdown.svg"))
w.setWindowTitle("A Taurus Filter Example")
w.setModel(host)
w.show()
sys.exit(app.exec_())
示例14: TaurusMacroConfigurationDialog
# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_args [as 别名]
Cancel dialog it doesn't do anything."""
dialog = TaurusMacroConfigurationDialog(self, self.modelName, self.doorName())
if dialog.exec_():
self.setModel(str(dialog.macroServerComboBox.currentText()))
self.emit(Qt.SIGNAL("doorChanged"), str(dialog.doorComboBox.currentText()))
else:
return
def onShortMessage(self, msg):
''' Slot to be called when there is a new short message. Currently, the only action
taken when there is a new message is to display it in the main window status bar.
:param msg: (str) the short descriptive message to be handled
'''
self.statusBar().showMessage(msg)
def test_macrocombobox(ms_name):
mcb = MacroComboBox()
mcb.setModel(ms_name)
mcb.show()
if __name__ == "__main__":
import sys
from taurus.qt.qtgui.application import TaurusApplication
app = TaurusApplication()
args = app.get_command_line_args()
ms_name = args[0]
test_macrocombobox(ms_name)
sys.exit(app.exec_())
示例15: taurusFormMain
# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import get_command_line_args [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_())