"print_control_identifiers()" 函数无法从 Dolphin Gamecube 模拟器上的 ComboBox 获取任何信息
"print_control_identifiers()" function doesn't get any info from a ComboBox on Dolphin Gamecube Emulator
我正在使用 Dolphin 5.0-6711 gcb 模拟器,这是旧版本之一,它使用 Qt5。我正在尝试打开 "File->Tools->Start Netplay..." 并从这个新打开的名为 "Dolphin NetPlay Setup" 的 window 启动主机。我可以编辑 Port
、Nickname
和 select 来自 ListBox
的游戏。但是我不能 select "Connection Type" ComboBox
中有 Direct Connection
和 Treversal Server
选项的任何项目。当我将 print_control_identifiers()
用于 "Dolphin NetPlay Setup" window 时,我看不到任何 ComboBox
项。这是 print_control_identifiers()
的输出:
Dialog - 'Dolphin NetPlay Setup' (L627, T351, R1277, B854)
[u'Dolphin NetPlay Setup', u'Dialog', u'Dolphin NetPlay SetupDialog']
child_window(title="Dolphin NetPlay Setup", control_type="Window")
|
| Pane - 'panel' (L636, T389, R1268, B845)
| ['Pane', u'panelPane0', u'panelPane1', u'panel', u'panelPane',
u'panel0', u'panel1', u'Pane1', u'Pane0']
| child_window(title="panel", auto_id="-31967", control_type="Pane")
| |
| | Static - 'Connection Type:' (L642, T398, R756, B419)
| | [u'Connection Type:Static', u'Connection Type:1', u'Connection
Type:0', u'Static', u'Connection Type:Static1', u'Connection Type:Static0',
u'Static1', u'Static0', u'Connection Type:']
| | child_window(title="Connection Type:", auto_id="-31966",
control_type="Text")
| |
| | ComboBox - 'Connection Type:' (L762, T395, R950, B423)
| | [u'Connection Type:ComboBox', u'Connection Type:2', 'ComboBox']
| | child_window(title="Connection Type:", auto_id="-31965",
control_type="ComboBox")
| | |
| | | Static - 'Connection Type:' (L3, T3, R164, B25)
| | | [u'Connection Type:3', u'Connection Type:Static2', u'Static2']
| | | child_window(title="Connection Type:", control_type="Text")
| | |
| | | Button - 'Open' (L930, T396, R949, B422)
| | | [u'OpenButton', u'Button1', u'Button0', u'Open', 'Button']
| | | child_window(title="Open", auto_id="DropDown", control_type="Button")
| |
| | Static - 'Nickname:' (L642, T432, R711, B453)
| | [u'Nickname:', u'Nickname:Static', u'Static3']
| | child_window(title="Nickname:", auto_id="-31963", control_type="Text")
| |
| | Edit - 'Nickname:' (L762, T429, R950, B457)
| | [u'', u'0', u'Edit1', u'Nickname:Edit', u'1', 'Edit', u'Edit0']
| | child_window(title="Nickname:", auto_id="-31962", control_type="Edit")
| |
| | Button - 'Quit' (L1162, T804, R1262, B839)
| | ['Button2', u'Quit', u'QuitButton']
| | child_window(title="Quit", auto_id="-31960", control_type="Button")
| |
| | TabControl - '' (L642, T490, R1262, B798)
| | [u'2', u'TabControlHost', u'TabControlConnect', u'TabControl']
| | child_window(auto_id="-31959", control_type="Tab")
| | |
| | | Pane - 'panel' (L646, T519, R1258, B794)
| | | [u'panelPane2', u'panel2', 'Pane2']
| | | child_window(title="panel", auto_id="-31957", control_type="Pane")
| | | |
| | | | Static - 'Port:' (L652, T528, R682, B549)
| | | | [u'Port:', u'Port:Static', u'Static4']
| | | | child_window(title="Port:", auto_id="-31949", control_type="Text")
| | | |
| | | | Edit - 'Port:' (L688, T525, R823, B553)
| | | | [u'3', u'Port:Edit', 'Edit2']
| | | | child_window(title="Port:", auto_id="-31948", control_type="Edit")
| | | |
| | | | Button - 'Host' (L1152, T753, R1252, B788)
| | | | [u'Host1', u'Host0', u'Host', 'Button3', u'HostButton']
| | | | child_window(title="Host", auto_id="-31945", control_type="Button")
| | | |
| | | | ListBox - '' (L652, T559, R1252, B747)
| | | | [u'4', u'ListBox']
| | | | child_window(auto_id="-31944", control_type="List")
| | | | |
| | | | | ListItem - 'CAPCOM VS. SNK 2 EO (GEOE08)' (L654, T561, R1250, B581)
| | | | | [u'ListItem', u'CAPCOM VS. SNK 2 EO (GEOE08)', u'CAPCOM VS. SNK 2 EO (GEOE08)ListItem']
| | | | | child_window(title="CAPCOM VS. SNK 2 EO (GEOE08)", control_type="ListItem")
| | | |
| | | | CheckBox - 'Forward Port (UPnP)' (L829, T529, R991, B549)
| | | | ['CheckBox', u'Forward Port (UPnP)', u'Forward Port (UPnP)CheckBox']
| | | | child_window(title="Forward Port (UPnP)", auto_id="-31943", control_type="CheckBox")
| | |
| | | TabItem - 'Connect' (L644, T492, R710, B517)
| | | [u'ConnectTabItem', 'TabItem', u'Connect', u'TabItem0', u'TabItem1']
| | | child_window(title="Connect", control_type="TabItem")
| | |
| | | TabItem - 'Host' (L710, T492, R770, B517)
| | | [u'Host2', 'TabItem2', u'HostTabItem']
| | | child_window(title="Host", control_type="TabItem")
|
| TitleBar - '' (L656, T354, R1268, B389)
| ['TitleBar', u'5']
| |
| | Menu - 'System' (L636, T360, R664, B388)
| | [u'System0', u'System1', u'System', u'Menu', u'SystemMenu']
| | child_window(title="System", auto_id="MenuBar", control_type="MenuBar")
| | |
| | | MenuItem - 'System' (L636, T360, R664, B388)
| | | [u'System2', u'MenuItem', u'SystemMenuItem']
| | | child_window(title="System", control_type="MenuItem")
| |
| | Button - 'Minimize' (L1090, T352, R1150, B389)
| | ['Button4', u'Minimize', u'MinimizeButton']
| | child_window(title="Minimize", control_type="Button")
| |
| | Button - 'Maximize' (L1150, T352, R1209, B389)
| | ['Button5', u'MaximizeButton', u'Maximize']
| | child_window(title="Maximize", control_type="Button")
| |
| | Button - 'Close' (L1209, T352, R1269, B389)
| | ['Button6', u'CloseButton', u'Close']
| | child_window(title="Close", control_type="Button")
这是我在没有 select 任何 ComboBox 项目的情况下启动主机的代码:
from pywinauto.application import Application
app = Application(backend="uia")
app.start(r"./Dolphin-x64/Dolphin.exe")
dlg = app["Dolphin"]
dlg.menu_select("Tools->Start NetP")
netplay = app["Dolphin NetPlay Setup"]
netplay.print_control_identifiers()
netplay.Pane.Edit.set_text(username)
netplay.Pane.TabControl.select("Host")
netplay.Pane.TabControl.Pane.Edit.set_text("9999")
netplay.Pane.TabControl.Pane.ListBox.child_window(title="CAPCOM VS. SNK 2 EO (GEOE08)", control_type="ListItem").select()
netplay.Pane.TabControl.Pane.Button.click()
我想 select ComboBox
中的第一个 "Direct Connection" 选项。我尝试了 select("Direct Connection")
和 select(0)
,但我无法决定应该使用哪一个进行导航。
在最新版本的 Dolphin 中,我什至无法从 print_control_identifiers()
获取主要 window 的任何信息,这就是我尝试使用这个旧版本的原因。
编辑:
我发现那个组合框中有一个秘密按钮。如果我单击 netplay.Pane.ComboBox.Button.click()
那个按钮,根据 netplay.print_control_identifiers()
,组合框内会出现一个 ListBox 和第二个秘密关闭按钮,即使我 select "Direct Connection" 项目在 ListBox 中,你也应该关闭第二个秘密关闭按钮影响 ComboBox 更改。
这是在 pywinauto 的 master 分支中修复的一些组合框 (issue #532) 的已知问题(尚未发布,将很快在 0.6.6 版本中)。您可以通过
尝试修复
pip uninstall pywinauto
pip install https://github.com/pywinauto/pywinauto/archive/master.zip
我还看到他们的 Qt 工具栏有“删除”的子按钮,通过鼠标悬停在 Inspect.exe
中可见,但工具栏没有将它们列为子按钮。我们也在研究与 MFC 工具栏相关的解决方法。这在 issue #413.
中进行了跟踪
EDIT1:最新版本的 Dolphin 的问题看起来很奇怪,可能是应用程序方面的问题。 Inspect.exe
显示错误 属性 Children
:
Children: [Error: calling getter for this property: hr=0xFFFFFFFF80004005 - Unspecified error]
但它可以以某种方式为主要 window 子级重建层次结构。这很有趣,对我来说看起来很新。我愿意更深入地研究这个问题。
EDIT2:我们通过使用 RawViewWalker 对象而不是 MS UI Automation API 中的 FindAll() 函数绕过了 Qt5 问题。如果你想参与下一个主要版本的早期测试(Windows 上的 beta 质量),你可以尝试这样安装:
pip uninstall -y pywinauto
pip install https://github.com/pywinauto/pywinauto/archive/atspi.zip
请注意,某些向后兼容性已被破坏,但所有错误消息都应告诉您在代码中替换什么以使其正常工作。如果某些错误消息不清楚,请随时在 GitHub 上报告新问题。谢谢!
我正在使用 Dolphin 5.0-6711 gcb 模拟器,这是旧版本之一,它使用 Qt5。我正在尝试打开 "File->Tools->Start Netplay..." 并从这个新打开的名为 "Dolphin NetPlay Setup" 的 window 启动主机。我可以编辑 Port
、Nickname
和 select 来自 ListBox
的游戏。但是我不能 select "Connection Type" ComboBox
中有 Direct Connection
和 Treversal Server
选项的任何项目。当我将 print_control_identifiers()
用于 "Dolphin NetPlay Setup" window 时,我看不到任何 ComboBox
项。这是 print_control_identifiers()
的输出:
Dialog - 'Dolphin NetPlay Setup' (L627, T351, R1277, B854)
[u'Dolphin NetPlay Setup', u'Dialog', u'Dolphin NetPlay SetupDialog']
child_window(title="Dolphin NetPlay Setup", control_type="Window")
|
| Pane - 'panel' (L636, T389, R1268, B845)
| ['Pane', u'panelPane0', u'panelPane1', u'panel', u'panelPane',
u'panel0', u'panel1', u'Pane1', u'Pane0']
| child_window(title="panel", auto_id="-31967", control_type="Pane")
| |
| | Static - 'Connection Type:' (L642, T398, R756, B419)
| | [u'Connection Type:Static', u'Connection Type:1', u'Connection
Type:0', u'Static', u'Connection Type:Static1', u'Connection Type:Static0',
u'Static1', u'Static0', u'Connection Type:']
| | child_window(title="Connection Type:", auto_id="-31966",
control_type="Text")
| |
| | ComboBox - 'Connection Type:' (L762, T395, R950, B423)
| | [u'Connection Type:ComboBox', u'Connection Type:2', 'ComboBox']
| | child_window(title="Connection Type:", auto_id="-31965",
control_type="ComboBox")
| | |
| | | Static - 'Connection Type:' (L3, T3, R164, B25)
| | | [u'Connection Type:3', u'Connection Type:Static2', u'Static2']
| | | child_window(title="Connection Type:", control_type="Text")
| | |
| | | Button - 'Open' (L930, T396, R949, B422)
| | | [u'OpenButton', u'Button1', u'Button0', u'Open', 'Button']
| | | child_window(title="Open", auto_id="DropDown", control_type="Button")
| |
| | Static - 'Nickname:' (L642, T432, R711, B453)
| | [u'Nickname:', u'Nickname:Static', u'Static3']
| | child_window(title="Nickname:", auto_id="-31963", control_type="Text")
| |
| | Edit - 'Nickname:' (L762, T429, R950, B457)
| | [u'', u'0', u'Edit1', u'Nickname:Edit', u'1', 'Edit', u'Edit0']
| | child_window(title="Nickname:", auto_id="-31962", control_type="Edit")
| |
| | Button - 'Quit' (L1162, T804, R1262, B839)
| | ['Button2', u'Quit', u'QuitButton']
| | child_window(title="Quit", auto_id="-31960", control_type="Button")
| |
| | TabControl - '' (L642, T490, R1262, B798)
| | [u'2', u'TabControlHost', u'TabControlConnect', u'TabControl']
| | child_window(auto_id="-31959", control_type="Tab")
| | |
| | | Pane - 'panel' (L646, T519, R1258, B794)
| | | [u'panelPane2', u'panel2', 'Pane2']
| | | child_window(title="panel", auto_id="-31957", control_type="Pane")
| | | |
| | | | Static - 'Port:' (L652, T528, R682, B549)
| | | | [u'Port:', u'Port:Static', u'Static4']
| | | | child_window(title="Port:", auto_id="-31949", control_type="Text")
| | | |
| | | | Edit - 'Port:' (L688, T525, R823, B553)
| | | | [u'3', u'Port:Edit', 'Edit2']
| | | | child_window(title="Port:", auto_id="-31948", control_type="Edit")
| | | |
| | | | Button - 'Host' (L1152, T753, R1252, B788)
| | | | [u'Host1', u'Host0', u'Host', 'Button3', u'HostButton']
| | | | child_window(title="Host", auto_id="-31945", control_type="Button")
| | | |
| | | | ListBox - '' (L652, T559, R1252, B747)
| | | | [u'4', u'ListBox']
| | | | child_window(auto_id="-31944", control_type="List")
| | | | |
| | | | | ListItem - 'CAPCOM VS. SNK 2 EO (GEOE08)' (L654, T561, R1250, B581)
| | | | | [u'ListItem', u'CAPCOM VS. SNK 2 EO (GEOE08)', u'CAPCOM VS. SNK 2 EO (GEOE08)ListItem']
| | | | | child_window(title="CAPCOM VS. SNK 2 EO (GEOE08)", control_type="ListItem")
| | | |
| | | | CheckBox - 'Forward Port (UPnP)' (L829, T529, R991, B549)
| | | | ['CheckBox', u'Forward Port (UPnP)', u'Forward Port (UPnP)CheckBox']
| | | | child_window(title="Forward Port (UPnP)", auto_id="-31943", control_type="CheckBox")
| | |
| | | TabItem - 'Connect' (L644, T492, R710, B517)
| | | [u'ConnectTabItem', 'TabItem', u'Connect', u'TabItem0', u'TabItem1']
| | | child_window(title="Connect", control_type="TabItem")
| | |
| | | TabItem - 'Host' (L710, T492, R770, B517)
| | | [u'Host2', 'TabItem2', u'HostTabItem']
| | | child_window(title="Host", control_type="TabItem")
|
| TitleBar - '' (L656, T354, R1268, B389)
| ['TitleBar', u'5']
| |
| | Menu - 'System' (L636, T360, R664, B388)
| | [u'System0', u'System1', u'System', u'Menu', u'SystemMenu']
| | child_window(title="System", auto_id="MenuBar", control_type="MenuBar")
| | |
| | | MenuItem - 'System' (L636, T360, R664, B388)
| | | [u'System2', u'MenuItem', u'SystemMenuItem']
| | | child_window(title="System", control_type="MenuItem")
| |
| | Button - 'Minimize' (L1090, T352, R1150, B389)
| | ['Button4', u'Minimize', u'MinimizeButton']
| | child_window(title="Minimize", control_type="Button")
| |
| | Button - 'Maximize' (L1150, T352, R1209, B389)
| | ['Button5', u'MaximizeButton', u'Maximize']
| | child_window(title="Maximize", control_type="Button")
| |
| | Button - 'Close' (L1209, T352, R1269, B389)
| | ['Button6', u'CloseButton', u'Close']
| | child_window(title="Close", control_type="Button")
这是我在没有 select 任何 ComboBox 项目的情况下启动主机的代码:
from pywinauto.application import Application
app = Application(backend="uia")
app.start(r"./Dolphin-x64/Dolphin.exe")
dlg = app["Dolphin"]
dlg.menu_select("Tools->Start NetP")
netplay = app["Dolphin NetPlay Setup"]
netplay.print_control_identifiers()
netplay.Pane.Edit.set_text(username)
netplay.Pane.TabControl.select("Host")
netplay.Pane.TabControl.Pane.Edit.set_text("9999")
netplay.Pane.TabControl.Pane.ListBox.child_window(title="CAPCOM VS. SNK 2 EO (GEOE08)", control_type="ListItem").select()
netplay.Pane.TabControl.Pane.Button.click()
我想 select ComboBox
中的第一个 "Direct Connection" 选项。我尝试了 select("Direct Connection")
和 select(0)
,但我无法决定应该使用哪一个进行导航。
在最新版本的 Dolphin 中,我什至无法从 print_control_identifiers()
获取主要 window 的任何信息,这就是我尝试使用这个旧版本的原因。
编辑:
我发现那个组合框中有一个秘密按钮。如果我单击 netplay.Pane.ComboBox.Button.click()
那个按钮,根据 netplay.print_control_identifiers()
,组合框内会出现一个 ListBox 和第二个秘密关闭按钮,即使我 select "Direct Connection" 项目在 ListBox 中,你也应该关闭第二个秘密关闭按钮影响 ComboBox 更改。
这是在 pywinauto 的 master 分支中修复的一些组合框 (issue #532) 的已知问题(尚未发布,将很快在 0.6.6 版本中)。您可以通过
尝试修复pip uninstall pywinauto
pip install https://github.com/pywinauto/pywinauto/archive/master.zip
我还看到他们的 Qt 工具栏有“删除”的子按钮,通过鼠标悬停在 Inspect.exe
中可见,但工具栏没有将它们列为子按钮。我们也在研究与 MFC 工具栏相关的解决方法。这在 issue #413.
EDIT1:最新版本的 Dolphin 的问题看起来很奇怪,可能是应用程序方面的问题。 Inspect.exe
显示错误 属性 Children
:
Children: [Error: calling getter for this property: hr=0xFFFFFFFF80004005 - Unspecified error]
但它可以以某种方式为主要 window 子级重建层次结构。这很有趣,对我来说看起来很新。我愿意更深入地研究这个问题。
EDIT2:我们通过使用 RawViewWalker 对象而不是 MS UI Automation API 中的 FindAll() 函数绕过了 Qt5 问题。如果你想参与下一个主要版本的早期测试(Windows 上的 beta 质量),你可以尝试这样安装:
pip uninstall -y pywinauto
pip install https://github.com/pywinauto/pywinauto/archive/atspi.zip
请注意,某些向后兼容性已被破坏,但所有错误消息都应告诉您在代码中替换什么以使其正常工作。如果某些错误消息不清楚,请随时在 GitHub 上报告新问题。谢谢!