本文整理汇总了Python中editxt.application.Application.windows方法的典型用法代码示例。如果您正苦于以下问题:Python Application.windows方法的具体用法?Python Application.windows怎么用?Python Application.windows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类editxt.application.Application
的用法示例。
在下文中一共展示了Application.windows方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import windows [as 别名]
def test(config, unordered=0):
"""
config - represents a list of window controllers in on-screen z-order
with the front-most window controller first. Key:
None - generic NSWindowController (not WindowController)
<int> - Window index in ac.windows
unordered - (optional, default 0) number of windows in
ac.windows that are not in the on-screen z-order window
list.
"""
ac = Application()
m = Mocker()
app_class = m.replace(ak, 'NSApp')
app = app_class()
eds = {}
unordered_eds = []
z_windows = []
for item in config:
if item is None:
wc = m.mock(ak.NSWindowController)
else:
wc = m.mock(WindowController)
ed = m.mock(Window)
print(ed, item)
if item != 7:
(wc.window_ << ed).count(3)
unordered_eds.append(ed)
else:
wc.window_ >> ed
eds[item] = ed
win = m.mock(ak.NSWindow)
win.windowController() >> wc
z_windows.append(win)
for x in range(unordered):
unordered_eds.append(m.mock(Window))
ac.windows = unordered_eds # + [v for k, v in sorted(eds.items())]
app.orderedWindows() >> z_windows
sorted_eds = [eds[i] for i in config if i not in (None, 7)]
sorted_eds.extend(ed for ed in unordered_eds if ed not in sorted_eds)
with m:
result = list(ac.iter_windows())
eq_(result, sorted_eds)