Example #1
0
def main():
    """
    Create the photo frame application
    """
    sys._excepthook = sys.excepthook
    sys.excepthook = exception_hook

    app = QtWidgets.QApplication(sys.argv)

    config = Config(FRAME_CONFIG)

    try:
        frame = PhotoFrame(config)
        frame.splash_screen(5000)

        app.processEvents()

        frame.setup()
        frame.start()

    except KeyError as exception:
        print("Error setting up frame: ", exception)
        sys.exit(1)

    app.exec_()
Example #2
0
def test_player_empty_playlist():
    """
    Test media player with no photos
    """
    window = PhotoFrame(Config("tests/test_empty.yml"))
    window.setup()
    window.start()
    assert window.get_current_player().get_playlist() == []
def test_next():
    """
    Test that 'next' navigation in non-shuffle mode moves from one photo to the next.
    """
    frame = PhotoFrame(Config("tests/test_navigation.yml"))
    frame.setup()
    frame.start()
    player = frame.get_current_player()
    num_photos = len(player.get_playlist())

    # assert player.current_media_index is None

    for i in range(num_photos * 2):  # loop past the end
        player.next()
        assert player.current_media_index == (i + 1) % num_photos
def skip_test_next_shuffle():
    """
    Test that 'next' navigation in shuffle mode does not give sequential photos.
    This tests uses a random shuffle which may occasionally match the sequential order and fail.
    May need to run the test again.
    """
    frame = PhotoFrame(Config("tests/test_navigation_shuffle.yml"))
    frame.setup()
    frame.start()
    player = frame.get_current_player()
    num_photos = len(player.get_playlist())

    assert player.current_media_index is None

    for i in range(
            min(4, num_photos)
    ):  # keep the number of transitions small to reduce the probabilty of this failing
        player.next()
        assert player.current_media_index != i
def _prev_test_with_config(config_filename):
    frame = PhotoFrame(Config(config_filename))
    frame.setup()
    frame.start()

    player = frame.get_current_player()
    num_photos = len(player.get_playlist())

    # assert player.current_media_index is None

    browsing_history = []
    # generate a browsing history
    for _ in range(num_photos * 2):
        player.next()
        browsing_history.append(player.current_media_index)

    # back-track with prev and compare to the browsing history
    for j in reversed(browsing_history):
        assert player.current_media_index == j
        player.prev()
def test_prev_no_history():
    frame = PhotoFrame(Config("tests/test_navigation.yml"))
    frame.setup()
    frame.start()

    player = frame.get_current_player()

    # generate a short browsing history
    for _ in range(10):
        player.next()

    # try to back-track with a longer browsing history
    # back-track with prev and compare to the browsing history
    for _ in range(10):
        player.prev()

    # current media should be None when history is empty
    player.prev()
    assert player.current_media_index is None

    player.prev()
    assert player.current_media_index is None
Example #7
0
def window():
    frame = PhotoFrame(Config("tests/test_config.yml"))
    frame.setup()
    frame.start()
    return frame
Example #8
0
def window():
    window = PhotoFrame(Config("tests/test_config.yml"))
    return window