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


Python MobberManager.rewind_driver方法代码示例

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


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

示例1: test_subscribe_to_mobber_list_changes

# 需要导入模块: from Infrastructure.MobberManager import MobberManager [as 别名]
# 或者: from Infrastructure.MobberManager.MobberManager import rewind_driver [as 别名]
    def test_subscribe_to_mobber_list_changes(self):
        mobber_manager = MobberManager()
        result = {"result": "Mobbers in List for Each Change\n", "increment": 0}

        def time_change_callback(mobber_list, driver_index, navigator_index):
            result["increment"] += 1
            result["result"] += "Action " + result["increment"].__str__() + ":"
            for mobber_index in range(0, mobber_list.__len__()):
                result["result"] += mobber_list[mobber_index]
                if mobber_index == driver_index:
                    result["result"] += " (Driver)"
                if mobber_index == navigator_index:
                    result["result"] += " (Navigator)"
                result["result"] += ", "

            result["result"] += "\n"

        mobber_manager.subscribe_to_mobber_list_change(time_change_callback)

        mobber_manager.add_mobber("Joe")
        mobber_manager.add_mobber("Chris")
        mobber_manager.add_mobber("Sam")
        mobber_manager.add_mobber("John")
        mobber_manager.switch_next_driver()
        mobber_manager.add_mobber("Bill")
        mobber_manager.switch_next_driver()
        mobber_manager.switch_next_driver()
        mobber_manager.switch_next_driver()
        mobber_manager.switch_next_driver()
        mobber_manager.switch_next_driver()
        mobber_manager.remove_mobber(2)
        mobber_manager.remove_mobber(0)
        mobber_manager.switch_next_driver()
        mobber_manager.rewind_driver()
        mobber_manager.add_mobber("Seth")
        mobber_manager.rewind_driver()
        mobber_manager.rewind_driver()
        mobber_manager.rewind_driver()
        mobber_manager.move_mobber_down(0)
        mobber_manager.add_mobber("Fredrick")
        mobber_manager.move_mobber_up(2)
        mobber_manager.remove_mobber(1)
        mobber_manager.remove_mobber(0)
        mobber_manager.remove_mobber(0)

        Approvals.verify(result["result"], self.reporter)
开发者ID:MobProgramming,项目名称:MobTimer.Python,代码行数:48,代码来源:TestsMobberManager.py

示例2: MobTimerController

# 需要导入模块: from Infrastructure.MobberManager import MobberManager [as 别名]
# 或者: from Infrastructure.MobberManager.MobberManager import rewind_driver [as 别名]

#.........这里部分代码省略.........
            else:
                self.countdown_manager.set_countdown_duration(extend_minutes, extend_seconds)
            self.set_partial_screen_transparent()

    def get_current_window_geometry(self):
        return "{0}x{1}+0+0".format(
                self.winfo_screenwidth(), self.winfo_screenheight())

    def disable_resizing(self):
        for container in self.containers:
            container.master.resizable(0, 0)

    def remove_title_bar(self):
        if PlatformUtility.platform_is_mac():
            return
        for container in self.containers:
            container.master.overrideredirect(1)

    def set_always_on_top(self):
        for container in self.containers:
            container.master.wm_attributes("-topmost", True)
            if PlatformUtility.platform_is_mac():
                os.system('''/usr/bin/osascript -e 'tell app "Finder" to set frontmost of process "Python" to true' ''')
                self.focus_force()
                self.focus()
            container.master.focus_force()

    def set_full_screen_always_on_top(self):
        self.set_always_on_top()
        self.remove_title_bar()
        self.disable_resizing()
        for container in self.containers:
            monitor = container.monitor
            monitor_string = "{}x{}+{}+{}".format(monitor.width, monitor.height, monitor.x, monitor.y)
            container.master.geometry(monitor_string)
            if not PlatformUtility.platform_is_mac():
                container.master.wait_visibility(container.master)  # Mac removing this prevented the issue with the continue screen visibility
            container.master.attributes("-alpha", 1)

    def set_partial_screen_transparent(self):
        self.set_always_on_top()
        self.remove_title_bar()
        self.disable_resizing()
        for controller in self.containers:
            screenwidth = self.winfo_screenwidth()
            screenheight = self.winfo_screenheight()

            size_percentage = self.settings_manager.get_transparent_window_screen_size_percent()
            alpha = self.settings_manager.get_transparent_window_alpha_percent()
            window_width = int(screenwidth * size_percentage)
            window_height = int(screenheight * size_percentage)
            window_size = "{0}x{1}+0+0".format(window_width, window_height)
            controller.master.geometry(window_size)
            controller.master.attributes("-alpha", alpha)
        self.toggle_transparent_frame_position()

    def fade_app(self):
        for controller in self.containers:
            controller.master.attributes("-alpha", self.settings_manager.get_continue_screen_blocker_window_alpha_percent())

    def unfade_app(self):
        for controller in self.containers:
            controller.master.attributes("-alpha", 1)

    def toggle_transparent_frame_position(self, e=None):
        if self.state() == "withdrawn":
            return

        monitors = ScreenUtility.get_monitors_or_default(self)
        monitor = monitors[self.transparent_frame_monitor_index]

        screenwidth = monitor.width
        screenheight = monitor.height

        self.set_always_on_top()
        self.remove_title_bar()
        self.disable_resizing()

        size_percentage = self.settings_manager.get_transparent_window_screen_size_percent()

        window_width = int(screenwidth * size_percentage)
        window_height = int(screenheight * size_percentage)
        if self.transparent_frame_position_index == 0:
            self.transparent_frame_position = monitor.x + screenwidth - window_width
            self.transparent_frame_monitor_index = (self.transparent_frame_monitor_index + 1) % (monitors.__len__())
        else:
            self.transparent_frame_position = monitor.x + 0
        self.transparent_frame_position_index = (self.transparent_frame_position_index + 1) % 2

        bottom_left_screen = "{}x{}+{}+{}".format(window_width, window_height, self.transparent_frame_position, monitor.y +
                                                  screenheight - window_height)
        self.geometry(bottom_left_screen)

    def rewind_and_extend(self,minutes, seconds):
        self.extensions_used += 1
        self.mobber_manager.rewind_driver()
        result = self.show_transparent_countdown_frame(minutes, seconds)
        for minimal_frame in self.frames[MinimalScreenBlockerFrame]:
            minimal_frame.show_extend_time_button()
        return result
开发者ID:brramos,项目名称:MobTimer.Python,代码行数:104,代码来源:MobTimerController.py


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