Beispiel #1
0
    def on_theme_list_cursor_changed(self, widget):
        """Executed when theme is changed in theme list. Update preview."""
        # Get currently selected theme
        themelist = self.builder.get_object("theme_list")
        model = themelist.get_model()
        selection = themelist.get_selection().get_selected()
        name = model.get_value(selection[1], 0)
        themedir = os.path.join(self.config.data_dir, 'themes', name)
        theme = Theme(theme_path=themedir)

        # Update preview
        image = self.builder.get_object("theme_image")
        image.set_from_file(os.path.join(themedir, "thumbnail.png"))
        name = self.builder.get_object("name_label")
        name.set_text(theme.getName())
        author = self.builder.get_object("author_label")
        author.set_text(theme.getAuthor())
        license_label = self.builder.get_object("license_label")
        license_label.set_text(theme.getLicence())
        copyright_label = self.builder.get_object("copyright_label")
        copyright_label.set_text(theme.getCopyright())
        comment = self.builder.get_object("comment_label")
        comment.set_text(theme.getComment())

        self.config.write_content_value("General", "theme", name.get_text())
Beispiel #2
0
class ThemeTest(EntertainerTest):
    """Test for entertainerlib.gui.theme"""
    def setUp(self):
        """Set up the test"""
        EntertainerTest.setUp(self)

        self.theme = Theme(self.config.theme_path)

    def tearDown(self):
        """Clean up after the test"""
        EntertainerTest.tearDown(self)

    def testCreate(self):
        """Test correct Theme initialization"""
        self.assertTrue(isinstance(self.theme, Theme))

    def testGetColor(self):
        """Test getting the color"""
        self.assertEqual(self.theme.get_color("background"), (21, 45, 83, 255))

    def testBadColor(self):
        """Test the output of color when it get a bad key element"""
        self.assertEqual(self.theme.get_color("junk"), (255, 0, 0, 255))
Beispiel #3
0
class ThemeTest(EntertainerTest):
    """Test for entertainerlib.gui.theme"""

    def setUp(self):
        """Set up the test"""
        EntertainerTest.setUp(self)

        self.theme = Theme(self.config.theme_path)

    def tearDown(self):
        """Clean up after the test"""
        EntertainerTest.tearDown(self)

    def testCreate(self):
        """Test correct Theme initialization"""
        self.assertTrue(isinstance(self.theme, Theme))

    def testGetColor(self):
        """Test getting the color"""
        self.assertEqual(self.theme.get_color("background"), (21, 45, 83, 255))

    def testBadColor(self):
        """Test the output of color when it get a bad key element"""
        self.assertEqual(self.theme.get_color("junk"), (255, 0, 0, 255))
Beispiel #4
0
    def __init__(self, test_dir=None):
        self.__dict__ = self._shared_state
        MessageHandler.__init__(self)

        if not self._shared_state or test_dir is not None:
            # Set in a production mode or a test mode
            if test_dir is None:
                self.resources = Resources()
            else:
                self.resources = Resources(config_testing_dir=test_dir)

            self.cache_dir = self.resources.cache_dir
            self.config_dir = self.resources.config_dir
            self.data_dir = self.resources.data_dir

            self.LOG = os.path.join(self.cache_dir, u'entertainer.log')

            self.MEDIA_DB = Database(os.path.join(self.cache_dir, 'media'))

            self.IMAGE_DB = os.path.join(self.cache_dir, 'image.db')
            self.MUSIC_DB = os.path.join(self.cache_dir, 'music.db')
            self.VIDEO_DB = os.path.join(self.cache_dir, 'video.db')

            self.THUMB_DIR = os.path.join(self.cache_dir, 'thumbnails')
            self.IMAGE_THUMB_DIR = os.path.join(self.THUMB_DIR, 'image')
            self.VIDEO_THUMB_DIR = os.path.join(self.THUMB_DIR, 'video')
            self.ALBUM_ART_DIR = os.path.join(self.cache_dir, 'album_art')
            self.MOVIE_ART_DIR = os.path.join(self.cache_dir, 'movie_art')

            self.read_config_file()

            self.theme = Theme(self.theme_path)

            self._stage_width = None
            self._stage_height = None

            # Network options specify the server type and extra options
            self.network_options = {
                'type': 'local',
                'host': 'localhost',
                'port': 55545
            }
Beispiel #5
0
    def setUp(self):
        """Set up the test"""
        EntertainerTest.setUp(self)

        self.theme = Theme(self.config.theme_path)
Beispiel #6
0
    def setUp(self):
        """Set up the test"""
        EntertainerTest.setUp(self)

        self.theme = Theme(self.config.theme_path)