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


Python TaurusApplication.setCursorFlashTime方法代码示例

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


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

示例1: main

# 需要导入模块: from taurus.qt.qtgui.application import TaurusApplication [as 别名]
# 或者: from taurus.qt.qtgui.application.TaurusApplication import setCursorFlashTime [as 别名]
def main():

    import optparse
    parser = optparse.OptionParser()
    options, arguments = parser.parse_args()

    if len(sys.argv) < 2:
        sys.exit("Please give a suitable SVG file as argument.")

    svg = arguments[0]
    section = arguments[1] if len(arguments) > 1 else None

    # == helpers ==

    def makeWidget(registry, section=None):
        # create a synoptic widget
        global s
        synoptic = SynopticWidget(registry=registry)
        synoptic.setModel(svg=svg, section=section)  # section is optional
        synoptic.rightClicked.connect(partial(on_rightclick, synoptic))
        synoptic.show()
        open_synoptics[id(synoptic)] = synoptic

    # == mouse interaction callbacks ===

    def on_rightclick(synoptic, kind, name):

        if kind == "section":
            # open a new synoptic widget showing the clicked section
            makeWidget(registry, str(name))

        elif kind == "device":
            # open the appropriate panel
            devclass = PyTango.Database().get_class_for_device(str(name))
            print devclass
            show_panel(name, devclass)

        print len(open_synoptics)
        print len(open_panels)

    def show_panel(device, cls):
        "Display a GUI panel for a device"
        if device in open_panels:
            # check if the panel exists already
            print "trying to raise existing window for", cls
            w = open_panels[device]
            if not w.isVisible():
                w.show()
            w.activateWindow()
            w.raise_()
        else:
            w = TaurusDevicePanel()
            w.setModel(str(device))
            w.show()
            open_panels[device] = w

    def on_focus_changed(old, new):
        print open_panels.values()
        if new:
            window = new.window()
            if window in open_panels.values():
                name = window.windowTitle()
                for syn in open_synoptics.values():
                    syn.select_devices([name])
                    #syn.zoom_to_device(name)

    app = TaurusApplication(sys.argv)
    app.setCursorFlashTime(0)

    open_panels = WeakValueDictionary()
    open_synoptics = WeakValueDictionary()

    registry = Registry()
    makeWidget(registry, section)

    QObject.connect(app, SIGNAL("focusChanged(QWidget *, QWidget *)"), on_focus_changed)
    app.exec_()
开发者ID:johanfforsberg,项目名称:taurus-svgsynoptic,代码行数:79,代码来源:synoptic.py


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