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


Python sysinfo.is_x64_OS函数代码示例

本文整理汇总了Python中pywinauto.sysinfo.is_x64_OS函数的典型用法代码示例。如果您正苦于以下问题:Python is_x64_OS函数的具体用法?Python is_x64_OS怎么用?Python is_x64_OS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: testClickVisibleIcon

    def testClickVisibleIcon(self):
        """
        Test minimizing a sample app into the visible area of the tray
        and restoring the app back
        """

        if is_x64_Python() != is_x64_OS():
            # We don't run this test for mixed cases:
            # a 32-bit Python process can't interact with
            # a 64-bit explorer process (taskbar) and vice versa
            return

        # Make sure that the hidden icons area is disabled
        orig_hid_state = _toggle_notification_area_icons(
                show_all=True,
                debug_img="%s_01" % (self.id())
                )

        self.dlg.Minimize()
        _wait_minimized(self.dlg)

        # click in the visible area
        taskbar.explorer_app.WaitCPUUsageLower(threshold=5, timeout=self.tm)
        taskbar.ClickSystemTrayIcon('MFCTrayDemo', double=True)
        self.dlg.Wait('active', timeout=self.tm)

        # Restore Notification Area settings
        _toggle_notification_area_icons(show_all=orig_hid_state,
                                        debug_img="%s_02" % (self.id()))
开发者ID:marloncruz,项目名称:pywinauto,代码行数:29,代码来源:test_taskbar.py

示例2: testWaitCPUUsageLower

 def testWaitCPUUsageLower(self):
     if is_x64_Python() != is_x64_OS():
         return None
     
     app = Application().Start(r'explorer.exe')
     WaitUntil(30, 0.5, lambda: len(findwindows.find_windows(active_only=True, class_name='CabinetWClass')) > 0)
     handle = findwindows.find_windows(active_only=True, class_name='CabinetWClass')[-1]
     window = WindowSpecification({'handle': handle, })
     explorer = Application().Connect(process=window.ProcessID())
     
     try:
         window.AddressBandRoot.ClickInput(double=True)
         window.Edit.SetEditText(r'Control Panel\Programs\Programs and Features')
         window.TypeKeys(r'{ENTER 2}', set_foreground=False)
         WaitUntil(30, 0.5, lambda: len(findwindows.find_windows(active_only=True, title='Programs and Features', class_name='CabinetWClass')) > 0)
         explorer.WaitCPUUsageLower(threshold=2.5, timeout=40, usage_interval=2)
         installed_programs = window.FolderView.Texts()[1:]
         programs_list = ','.join(installed_programs)
         if ('Microsoft' not in programs_list) and ('Python' not in programs_list):
             HwndWrapper.ImageGrab.grab().save(r'explorer_screenshot.jpg')
         HwndWrapper.ActionLogger().log('\ninstalled_programs:\n')
         for prog in installed_programs:
             HwndWrapper.ActionLogger().log(prog)
         self.assertEqual(('Microsoft' in programs_list) or ('Python' in programs_list), True)
     finally:
         window.Close(2.0)
开发者ID:nnamon,项目名称:pywinauto,代码行数:26,代码来源:test_application.py

示例3: setUp

    def setUp(self):
        """Start the application set some data and ensure the application
        is in the state we want it."""

        # start the application
        self.app = Application()
        if is_x64_Python() or not is_x64_OS():
            self.app.start_(r"C:\Windows\System32\notepad.exe")
        else:
            self.app.start_(r"C:\Windows\SysWOW64\notepad.exe")

        # Get the old font
        self.app.UntitledNotepad.Wait('ready', 50)
        self.app.UntitledNotepad.MenuSelect("Format->Font...")
        self.app.Font.Wait("visible", 50)

        self.old_font = self.app.Font.FontComboBox.SelectedIndex()
        self.old_font_style = self.app.Font.FontStyleCombo.SelectedIndex()

        # ensure we have the correct settings for this test
        self.app.Font.FontStyleCombo.Select(0)
        self.app.Font.FontComboBox.Select("Lucida Console")
        self.app.Font.OK.Click()

        self.dlg = self.app.Window_(title='Untitled - Notepad', class_name='Notepad')
        self.ctrl = HwndWrapper(self.dlg.Edit.handle)
        self.dlg.edit.SetEditText("Here is some text\r\n and some more")
开发者ID:softandbyte,项目名称:pywinauto,代码行数:27,代码来源:test_HwndWrapper.py

示例4: test_is64bitprocess

    def test_is64bitprocess(self):
        "Make sure a 64-bit process detection returns correct results"
 
        if is_x64_OS():
            # Test a 32-bit app running on x64
            expected_is64bit = False
            if is_x64_Python():
                exe32bit = os.path.join(os.path.dirname(__file__),
                              r"..\..\apps\MFC_samples\RowList.exe")
                app = Application().start_(exe32bit, timeout=20)
                pid = app.RowListSampleApplication.ProcessID()
                res_is64bit = is64bitprocess(pid)
                try:
                    self.assertEquals(expected_is64bit, res_is64bit)
                finally:
                    # make sure to close an additional app we have opened
                    app.kill_()

                # setup expected for a 64-bit app on x64
                expected_is64bit = True
        else:
            # setup expected for a 32-bit app on x86
            expected_is64bit = False

        # test native Notepad app
        res_is64bit = is64bitprocess(self.app.UntitledNotepad.ProcessID())
        self.assertEquals(expected_is64bit, res_is64bit)
开发者ID:softandbyte,项目名称:pywinauto,代码行数:27,代码来源:test_handleprops.py

示例5: setUp

 def setUp(self):
     """Start the application set some data and ensure the application
     is in the state we want it."""
     self.prev_warn = warnings.showwarning
     def no_warnings(*args, **kwargs): pass
     warnings.showwarning = no_warnings
     if is_x64_Python() or not is_x64_OS():
         self.notepad_subpath = r"system32\notepad.exe"
     else:
         self.notepad_subpath = r"SysWOW64\notepad.exe"
开发者ID:kiennguyen1101,项目名称:ftkController,代码行数:10,代码来源:test_application.py

示例6: setUp

    def setUp(self):
        """Start the application set some data and ensure the application
        is in the state we want it."""

        self.app = Application()

        if is_x64_Python() or not is_x64_OS():
            self.app.start(r"C:\Windows\System32\calc.exe")
        else:
            self.app.start(r"C:\Windows\SysWOW64\calc.exe")
        self.calc = self.app.Calculator
        self.calc.MenuSelect("View->Scientific")
开发者ID:Anton-Lazarev,项目名称:pywinauto,代码行数:12,代码来源:test_win32controls.py

示例7: setUp

    def setUp(self):
        """Start the application set some data and ensure the application
        is in the state we want it."""

        # start the application
        self.app = Application()
        if is_x64_Python() or not is_x64_OS():
            self.app.start(r"C:\Windows\System32\notepad.exe")
        else:
            self.app.start(r"C:\Windows\SysWOW64\notepad.exe")

        self.dlg = self.app.UntitledNotepad
        self.ctrl = HwndWrapper(self.dlg.Edit.handle)
开发者ID:gitter-badger,项目名称:pywinauto,代码行数:13,代码来源:test_HwndWrapper.py

示例8: testStartWarning3264

 def testStartWarning3264(self):
     if not is_x64_OS():
         self.defaultTestResult()
         return
     
     warnings.filterwarnings('always', category=UserWarning, append=True)
     with warnings.catch_warnings(record=True) as w:
         warnings.simplefilter("always")
         app = Application.start(self.sample_exe)
         app.kill_()
         assert len(w) >= 1
         assert issubclass(w[-1].category, UserWarning)
         assert "64-bit" in str(w[-1].message)
开发者ID:kiennguyen1101,项目名称:ftkController,代码行数:13,代码来源:test_application.py

示例9: is64bitprocess

def is64bitprocess(process_id):
    """Return True if the specified process is a 64-bit process on x64
       and False if it is only a 32-bit process running under Wow64.
       Always return False for x86"""

    from pywinauto.sysinfo import is_x64_OS
    is32 = True
    if is_x64_OS():
        import win32process, win32api
        phndl = win32api.OpenProcess(0x400, 0, process_id)
        if phndl:
          is32 = win32process.IsWow64Process(phndl)
          #print("is64bitprocess, is32: %d, procid: %d" % (is32, process_id))
        
    return (not is32)
开发者ID:vasily-v-ryabov,项目名称:pywinauto-64,代码行数:15,代码来源:handleprops.py

示例10: setUp

        def setUp(self):
            """Start the application set some data and ensure the application
            is in the state we want it."""

            # TODO: re-write the whole test
            self.app = Application(backend="native")
            if is_x64_Python() or not is_x64_OS():
                self.app.start(r"C:\Windows\System32\calc.exe")
            else:
                self.app.start(r"C:\Windows\SysWOW64\calc.exe")
            
            self.dlg = self.app.Calculator
            self.handle = self.dlg.handle
            self.dlg.MenuSelect('View->Scientific\tAlt+2')
            self.ctrl = UIAElementInfo(self.dlg.handle)
开发者ID:Anton-Lazarev,项目名称:pywinauto,代码行数:15,代码来源:test_UIAElementInfo.py

示例11: testConnect_path

    def testConnect_path(self):
        "Test that connect_() works with a path"
        app1 = Application()
        app1.start_(_notepad_exe())

        app_conn = Application()
        app_conn.connect_(path = self.notepad_subpath)
        self.assertEqual(app1.process, app_conn.process)

        app_conn = Application()
        if is_x64_Python() or not is_x64_OS():
            app_conn.connect_(path = r"c:\windows\system32\notepad.exe")
        else:
            app_conn.connect_(path = r"c:\windows\syswow64\notepad.exe")
        self.assertEqual(app1.process, app_conn.process)

        app_conn.UntitledNotepad.MenuSelect('File->Exit')
开发者ID:kiennguyen1101,项目名称:ftkController,代码行数:17,代码来源:test_application.py

示例12: testClickVisibleIcon

    def testClickVisibleIcon(self):
        """
        Test minimizing a sample app into the visible area of the tray
        and restoring the app back
        """

        if is_x64_Python() != is_x64_OS():
            # We don't run this test for mixed cases:
            # a 32-bit Python process can't interact with
            # a 64-bit explorer process (taskbar) and vice versa
            return

        # Make sure that the hidden icons area is disabled
        orig_hid_state = _toggle_notification_area_icons(
            show_all=True,
            debug_img="%s_01" % (self.id())
        )

        self.dlg.minimize()
        _wait_minimized(self.dlg)

        menu_window = [None]

        # Click in the visible area and wait for a popup menu
        def _show_popup_menu():
            taskbar.explorer_app.wait_cpu_usage_lower(threshold=5, timeout=self.tm)
            taskbar.RightClickSystemTrayIcon('MFCTrayDemo')
            menu = self.app.top_window().children()[0]
            res = isinstance(menu, ToolbarWrapper) and menu.is_visible()
            menu_window[0] = menu
            return res

        wait_until(self.tm, _retry_interval, _show_popup_menu)
        menu_window[0].menu_bar_click_input("#2", self.app)
        popup_window = self.app.top_window()
        hdl = self.dlg.popup_window()
        self.assertEqual(popup_window.handle, hdl)

        taskbar.ClickSystemTrayIcon('MFCTrayDemo', double=True)
        self.dlg.wait('active', timeout=self.tm)

        # Restore Notification Area settings
        _toggle_notification_area_icons(show_all=orig_hid_state,
                                        debug_img="%s_02" % (self.id()))
开发者ID:pywinauto,项目名称:pywinauto,代码行数:44,代码来源:test_taskbar.py

示例13: testClickHiddenIcon

    def testClickHiddenIcon(self):
        """
        Test minimizing a sample app into the hidden area of the tray
        and restoring the app back
        """

        if is_x64_Python() != is_x64_OS():
            # We don't run this test for mixed cases:
            # a 32-bit Python process can't interact with
            # a 64-bit explorer process (taskbar) and vice versa
            return

        # Make sure that the hidden icons area is enabled
        orig_hid_state = _toggle_notification_area_icons(
                show_all=False,
                debug_img="%s_01" % (self.id())
                )

        self.dlg.Minimize()
        _wait_minimized(self.dlg)

        # Run one more instance of the sample app
        # hopefully one of the icons moves into the hidden area
        self.app2 = Application()
        self.app2.start(os.path.join(mfc_samples_folder, u"TrayMenu.exe"))
        dlg2 = self.app2.TrayMenu
        dlg2.Wait('visible', timeout=self.tm)
        dlg2.Minimize()
        _wait_minimized(dlg2)

        # Click in the hidden area
        taskbar.explorer_app.WaitCPUUsageLower(threshold=5, timeout=40)
        taskbar.ClickHiddenSystemTrayIcon('MFCTrayDemo', double=True)
        self.dlg.Wait('visible', timeout=self.tm)

        # Restore Notification Area settings
        _toggle_notification_area_icons(show_all=orig_hid_state,
                                        debug_img="%s_02" % (self.id()))

        dlg2.SendMessage(win32defines.WM_CLOSE)
        self.app2 = None
开发者ID:marloncruz,项目名称:pywinauto,代码行数:41,代码来源:test_taskbar.py

示例14: test_connect_path

    def test_connect_path(self):
        """Test that connect_() works with a path"""
        app1 = Application()
        app1.start(_notepad_exe())

        app_conn = Application()
        app_conn.connect(path=self.notepad_subpath)
        self.assertEqual(app1.process, app_conn.process)

        app_conn = Application()
        if is_x64_Python() or not is_x64_OS():
            app_conn.connect(path=r"c:\windows\system32\notepad.exe")
        else:
            app_conn.connect(path=r"c:\windows\syswow64\notepad.exe")
        self.assertEqual(app1.process, app_conn.process)

        accessible_modules = process_get_modules()
        accessible_process_names = [os.path.basename(name.lower()) for process, name, cmdline in accessible_modules]
        self.assertEquals('notepad.exe' in accessible_process_names, True)

        app_conn.UntitledNotepad.MenuSelect('File->Exit')
开发者ID:Anton-Lazarev,项目名称:pywinauto,代码行数:21,代码来源:test_application.py

示例15: testClickVisibleIcon

    def testClickVisibleIcon(self):
        """
        Test minimizing a sample app into the visible area of the tray
        and restoring the app back
        """

        if is_x64_Python() != is_x64_OS():
            # We don't run this test for mixed cases:
            # a 32-bit Python process can't interact with
            # a 64-bit explorer process (taskbar) and vice versa
            return

        # Make sure that the hidden icons area is disabled
        orig_hid_state = _toggle_notification_area_icons(
                show_all=True,
                debug_img="%s_01" % (self.id())
                )

        self.dlg.Minimize()
        _wait_minimized(self.dlg)

        # click in the visible area
        taskbar.explorer_app.WaitCPUUsageLower(threshold=5, timeout=self.tm)
        taskbar.RightClickSystemTrayIcon('MFCTrayDemo')

        # verify PopupWindow method
        menu_window = self.app.top_window_().Children()[0]
        WaitUntil(self.tm, _retry_interval, menu_window.IsVisible)
        menu_window.MenuBarClickInput("#2", self.app)
        popup_window = self.app.top_window_()
        hdl = self.dlg.PopupWindow()
        self.assertEquals(popup_window.handle, hdl)

        taskbar.ClickSystemTrayIcon('MFCTrayDemo', double=True)
        self.dlg.Wait('active', timeout=self.tm)

        # Restore Notification Area settings
        _toggle_notification_area_icons(show_all=orig_hid_state,
                                        debug_img="%s_02" % (self.id()))
开发者ID:2nty7vn,项目名称:pywinauto,代码行数:39,代码来源:test_taskbar.py


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