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


Python MobberManager.switch_next_driver方法代码示例

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


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

示例1: test_switch_navigator0_driver1_index

# 需要导入模块: from Infrastructure.MobberManager import MobberManager [as 别名]
# 或者: from Infrastructure.MobberManager.MobberManager import switch_next_driver [as 别名]
 def test_switch_navigator0_driver1_index(self):
     mobber_manager = MobberManager()
     mobber_manager.add_mobber("Joe")
     mobber_manager.add_mobber("Chris")
     mobber_manager.switch_next_driver()
     result = "Navigator: " + str(mobber_manager.next_driver_index) + " Driver: " + str(mobber_manager.driver_index)
     self.assertEqual(result, "Navigator: 0 Driver: 1")
开发者ID:MobProgramming,项目名称:MobTimer.Python,代码行数:9,代码来源:TestsMobberManager.py

示例2: test_subscribe_to_mobber_list_changes

# 需要导入模块: from Infrastructure.MobberManager import MobberManager [as 别名]
# 或者: from Infrastructure.MobberManager.MobberManager import switch_next_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

示例3: MobTimerController

# 需要导入模块: from Infrastructure.MobberManager import MobberManager [as 别名]
# 或者: from Infrastructure.MobberManager.MobberManager import switch_next_driver [as 别名]
class MobTimerController(Tk):
    def __init__(self, *args, **kwargs):
        Tk.__init__(self, *args, **kwargs)
        self.transparent_frame_monitor_index = 0
        self.transparent_frame_position_index = 0
        self.settings_manager = SettingsManager()
        self.tips_manager = TipsManager()
        self.time_options_manager = TimeSettingsManager()
        self.mobber_manager = MobberManager(self.settings_manager.get_randomize_randomize_next_driver())
        self.countdown_manager = CountdownManager(self)
        self.session_manager = SessionManager(uuid)
        self.timer_extension_count = self.settings_manager.get_timer_extension_count()
        self.extensions_used = 0
        atexit.register(self.session_manager.clear_sessions)
        if self.session_manager.get_active_sessions().__len__() > 0:
            self.quit_and_destroy_session()

        self.session_manager.create_session()
        self.iconbitmap(default='time-bomb.ico')
        self.countdown_manager.subscribe_to_time_changes(self.show_screen_blocker_when_session_interupted)

        self.theme_manager = ThemeManager()
        theme = self.settings_manager.get_general_theme()
        if not theme == 'none':
            self.theme_manager.set_theme(theme)
        monitors = ScreenUtility.get_monitors_or_default()
        num_monitors = monitors.__len__()
        self.parent_containers = [self]
        self.containers = []
        for monitor_index in range(1, num_monitors):
            monitor_screen_blocker = Toplevel(self)
            self.parent_containers.append(monitor_screen_blocker)
        self.frame_types = (ScreenBlockerFrame, TransparentCountdownFrame, MinimalScreenBlockerFrame)
        self.frames = {}
        for frame_type in self.frame_types:
            self.frames[frame_type] = []
        for parent_container, monitor in zip(self.parent_containers, monitors):
            parent_container.grid_rowconfigure(0, weight=1)
            parent_container.grid_columnconfigure(0, weight=1)

            container = OuterFrame(parent=parent_container, monitor=monitor)
            self.containers.append(container)
            container.grid(row=0, column=0, sticky=(N, S, E, W))
            container.grid_rowconfigure(0, weight=1)
            container.grid_columnconfigure(0, weight=1)
            for frame_type in self.frame_types:
                frame_instance = frame_type(container, self, self.time_options_manager, self.mobber_manager,
                                            self.countdown_manager, self.settings_manager, self.tips_manager, self.theme_manager)
                self.frames[frame_type].append(frame_instance)
                frame_instance.grid(row=0, column=0, sticky=(N, S, E, W))
                frame_instance.grid_rowconfigure(0, weight=1)
                frame_instance.grid_columnconfigure(0, weight=1)
        self.last_frame = None
        self.show_screen_blocker_frame()
        for frame_instance in self.frames[TransparentCountdownFrame]:
            frame_instance.bind("<Enter>", self.toggle_transparent_frame_position)
        self.transparent_frame_position = 0
        self.title("Mob Timer")
        self.bind_all("<Control-Return>", self.launch_transparent_countdown_if_blocking)
        self.time_options_manager.set_countdown_time(self.settings_manager.get_timer_minutes(), self.settings_manager.get_timer_seconds())

    def launch_transparent_countdown_if_blocking(self, event):
        if self.frame_is_screen_blocking():
            self.show_transparent_countdown_frame()

    def frame_is_screen_blocking(self):
        return self.last_frame == ScreenBlockerFrame or self.last_frame == MinimalScreenBlockerFrame

    def show_minimal_screen_blocker_frame(self):
        if self.last_frame != MinimalScreenBlockerFrame:
            self.launch_blocking_Frame(MinimalScreenBlockerFrame)
            self.mobber_manager.switch_next_driver()

    def quit_and_destroy_session(self):
        self.session_manager.clear_sessions()
        self.quit()
        sys.exit()

    def show_screen_blocker_when_session_interupted(self, days, minutes, seconds):
        if self.session_manager.get_active_sessions().__len__() == 0:
            self.show_screen_blocker_frame()
            self.session_manager.create_session()

    def show_frame(self, frame_class):
        switched_frames = False
        if self.last_frame != frame_class:
            for frame_instances in self.frames[frame_class]:
                frame_instances.tkraise()

            switched_frames = True
            self.focus_force()
            self.focus_set()
        self.last_frame = frame_class

        for container in self.parent_containers:
            if isinstance(container, Toplevel):
                if self.frame_is_screen_blocking():
                    container.deiconify()
                else:
                    container.withdraw()
#.........这里部分代码省略.........
开发者ID:brramos,项目名称:MobTimer.Python,代码行数:103,代码来源:MobTimerController.py


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