コード例 #1
0
ファイル: test_clock.py プロジェクト: signove/rptool
 def test_clock_should_count_time_between_start_and_stop(self):
     """ Test if is counting the time elapsed after start until stop. """
     clock = Clock()
     clock.start()
     time.sleep(1)
     clock.stop()
     self.assertTrue(clock.getTime() == 1, "Expected time be 1s")
     clock.start()
     time.sleep(2)
     clock.stop()
     print(clock.getTime())
     self.assertTrue(clock.getTime() == 2, "Expected time be 2s")
コード例 #2
0
ファイル: recorder.py プロジェクト: signove/rptool
 def __init__(self, file_manager):
     self.file = ''
     self.fileManager = file_manager
     self.log = Logger('Recorder')
     self.mouseListener = MouseListener(on_click=self.onClick, on_scroll=self.onScroll, on_move=self.onMove)
     self.keyboardListener = KeyboardListener(on_press=self.onPress, on_release=self.onRelease)
     self.clock = Clock()
     self.alert = Alert('RPTool - Recording')
     self.drag_start = (0, 0)
     self.drag_end = (0, 0)
     self.verifier = Verifier()
     self.pauseTrace = False
コード例 #3
0
 def __init__(self):
     Thread.__init__(self)
     self.session = Session()
     self.session.add_listener(self)
     self.play_state = PlayStates.stopped
     self.playhead = PlayHead()
     # dummy eventhandler, doesn't actually handle them. Inject acutual one via set_event_handler()
     self.event_handler: EventHandler = EventHandler()
     self.clock = Clock(tick_time_ms=1000)
     self.keep_thread_active = True
     self.update_looping_position()
     self.rewind()
     self.start()
コード例 #4
0
    def __init__(self, name, master_seed, **clock_params):
        """Create a new Container object

        :param master_seed: seed used to initialized random generatof of
        other seeds
        :type master_seed: int

        :rtype: Container
        :return: a new Container object, with the clock, is created
        """
        self.name = name

        self.master_seed = master_seed
        self.clock_params = clock_params

        self.seeder = seed_provider(master_seed=master_seed)
        self.clock = Clock(seed=next(self.seeder), **clock_params)
        self.stories = []
        self.populations = {}
        self.generators = {}
コード例 #5
0
ファイル: test_clock.py プロジェクト: signove/rptool
 def test_clock_start_with_zero(self):
     """ Test if the clock starts counting from zero. """
     clock = Clock()
     clock.start()
     self.assertTrue(clock.getTime() == 0, "Expected clock counting zero when starts!")
コード例 #6
0
ファイル: test_clock.py プロジェクト: signove/rptool
 def test_clock_get_time(self):
     """ Test if the clock is started """
     clock = Clock()
     clock.start()
     time.sleep(1)
     self.assertFalse(clock.getTime() == 1, "Expected be counting 1 second!")