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


Python MobberManager.MobberManager类代码示例

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


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

示例1: test_add_mobber_joe_chris_joe__remove_joe_has_joe_chris

 def test_add_mobber_joe_chris_joe__remove_joe_has_joe_chris(self):
     mobber_manager = MobberManager()
     mobber_manager.add_mobber("Joe")
     mobber_manager.add_mobber("Chris")
     mobber_manager.add_mobber("John")
     mobber_manager.remove_mobber(2)
     result = ["Joe", "Chris"]
     self.assertEqual(mobber_manager.get_mobbers(), result)
开发者ID:MobProgramming,项目名称:MobTimer.Python,代码行数:8,代码来源:TestsMobberManager.py

示例2: test_clear

 def test_clear(self):
     mobber_manager = MobberManager()
     mobber_manager.add_mobber("Joe")
     mobber_manager.add_mobber("Chris")
     mobber_manager.add_mobber("Sam")
     mobber_manager.clear()
     result = []
     self.assertEqual(mobber_manager.get_mobbers(), result)
开发者ID:MobProgramming,项目名称:MobTimer.Python,代码行数:8,代码来源:TestsMobberManager.py

示例3: test_add_4_mobbers_move_down_bottom

 def test_add_4_mobbers_move_down_bottom(self):
     mobber_manager = MobberManager()
     mobber_manager.add_mobber("Joe")
     mobber_manager.add_mobber("Chris")
     mobber_manager.add_mobber("Will")
     mobber_manager.add_mobber("Eric")
     mobber_manager.move_mobber_down(3)
     result = ["Eric", "Chris", "Will", "Joe"]
     self.assertEqual(mobber_manager.get_mobbers(), result)
开发者ID:MobProgramming,项目名称:MobTimer.Python,代码行数:9,代码来源:TestsMobberManager.py

示例4: test_add_4_mobbers_move_up_middle

 def test_add_4_mobbers_move_up_middle(self):
     mobber_manager = MobberManager()
     mobber_manager.add_mobber("Joe")
     mobber_manager.add_mobber("Chris")
     mobber_manager.add_mobber("Will")
     mobber_manager.add_mobber("Eric")
     mobber_manager.move_mobber_up(2)
     result = ["Joe", "Will", "Chris", "Eric"]
     self.assertEqual(mobber_manager.get_mobbers(), result)
开发者ID:MobProgramming,项目名称:MobTimer.Python,代码行数:9,代码来源:TestsMobberManager.py

示例5: __init__

    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())
开发者ID:brramos,项目名称:MobTimer.Python,代码行数:59,代码来源:MobTimerController.py

示例6: test_switch_navigator0_driver1_index

 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,代码行数:7,代码来源:TestsMobberManager.py

示例7: test_remove_empty

 def test_remove_empty(self):
     mobber_manager = MobberManager()
     mobber_manager.remove_mobber(0)
     result = []
     self.assertEqual(mobber_manager.get_mobbers(), result)
开发者ID:MobProgramming,项目名称:MobTimer.Python,代码行数:5,代码来源:TestsMobberManager.py

示例8: test_add_mobber_chris_has_chris

 def test_add_mobber_chris_has_chris(self):
     mobber_manager = MobberManager()
     mobber_manager.add_mobber("Chris")
     result = ["Chris"]
     self.assertEqual(mobber_manager.get_mobbers(), result)
开发者ID:MobProgramming,项目名称:MobTimer.Python,代码行数:5,代码来源:TestsMobberManager.py

示例9: test_subscribe_to_mobber_list_changes_random

    def test_subscribe_to_mobber_list_changes_random(self):
        random.seed(0)
        mobber_manager = MobberManager(True)
        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"] += " (Next)"
                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.set_mobber_list(["Hello", "Eric", "Joe"])
        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.add_mobber("Seth")
        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,代码行数:44,代码来源:TestsMobberManager.py

示例10: test_empty_mobber_manager_has_no_items

 def test_empty_mobber_manager_has_no_items(self):
     mobber_manager = MobberManager()
     self.assertEqual(mobber_manager.mobber_count(), 0)
开发者ID:MobProgramming,项目名称:MobTimer.Python,代码行数:3,代码来源:TestsMobberManager.py

示例11: MobTimerController

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,代码行数:101,代码来源:MobTimerController.py


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