Beispiel #1
0
    def test_extend_image_filename(self):
        """
        Test the extend_image_filename method
        """
        # GIVEN: A theme object
        theme = ThemeXML()
        theme.theme_name = 'MyBeautifulTheme   '
        theme.background_filename = '    video.mp4'
        theme.background_type = 'video'
        path = os.path.expanduser('~')

        # WHEN: ThemeXML.extend_image_filename is run
        theme.extend_image_filename(path)

        # THEN: The filename of the background should be correct
        expected_filename = os.path.join(path, 'MyBeautifulTheme', 'video.mp4')
        self.assertEqual(expected_filename, theme.background_filename)
        self.assertEqual('MyBeautifulTheme', theme.theme_name)
Beispiel #2
0
 def load_first_time_themes(self):
     """
     Imports any themes on start up and makes sure there is at least one theme
     """
     self.application.set_busy_cursor()
     files = AppLocation.get_files(self.settings_section, '.otz')
     for theme_file in files:
         theme_file = os.path.join(self.path, theme_file)
         self.unzip_theme(theme_file, self.path)
         delete_file(theme_file)
     files = AppLocation.get_files(self.settings_section, '.png')
     # No themes have been found so create one
     if not files:
         theme = ThemeXML()
         theme.theme_name = UiStrings().Default
         self._write_theme(theme, None, None)
         Settings().setValue(self.settings_section + '/global theme', theme.theme_name)
     self.application.set_normal_cursor()
Beispiel #3
0
    def test_extend_image_filename(self):
        """
        Test the extend_image_filename method
        """
        # GIVEN: A theme object
        theme = ThemeXML()
        theme.theme_name = 'MyBeautifulTheme   '
        theme.background_filename = '    video.mp4'
        theme.background_type = 'video'
        path = os.path.expanduser('~')

        # WHEN: ThemeXML.extend_image_filename is run
        theme.extend_image_filename(path)

        # THEN: The filename of the background should be correct
        expected_filename = os.path.join(path, 'MyBeautifulTheme', 'video.mp4')
        self.assertEqual(expected_filename, theme.background_filename)
        self.assertEqual('MyBeautifulTheme', theme.theme_name)
Beispiel #4
0
 def load_first_time_themes(self):
     """
     Imports any themes on start up and makes sure there is at least one theme
     """
     self.application.set_busy_cursor()
     files = AppLocation.get_files(self.settings_section, '.otz')
     for theme_file in files:
         theme_file = os.path.join(self.path, theme_file)
         self.unzip_theme(theme_file, self.path)
         delete_file(theme_file)
     files = AppLocation.get_files(self.settings_section, '.png')
     # No themes have been found so create one
     if not files:
         theme = ThemeXML()
         theme.theme_name = UiStrings().Default
         self._write_theme(theme, None, None)
         Settings().setValue(self.settings_section + '/global theme',
                             theme.theme_name)
     self.application.set_normal_cursor()