コード例 #1
0
    def test_image_filenames_table(self):
        """
        Test that the ImageFilenames table is correctly upgraded to the latest version
        """
        # GIVEN: An unversioned image database
        temp_db_name = os.path.join(self.tmp_folder, 'image-v0.sqlite')
        shutil.copyfile(
            os.path.join(TEST_RESOURCES_PATH, 'images', 'image-v0.sqlite'),
            temp_db_name)

        with patch.object(AppLocation,
                          'get_data_path',
                          return_value=Path('/', 'test', 'dir')):
            # WHEN: Initalising the database manager
            manager = Manager('images',
                              init_schema,
                              db_file_path=temp_db_name,
                              upgrade_mod=upgrade)

            # THEN: The database should have been upgraded and image_filenames.file_path should return Path objects
            upgraded_results = manager.get_all_objects(ImageFilenames)

            expected_result_data = {
                1: Path('/', 'test', 'image1.jpg'),
                2: Path('/', 'test', 'dir', 'image2.jpg'),
                3: Path('/', 'test', 'dir', 'subdir', 'image3.jpg')
            }

            assert len(upgraded_results) == 3
            for result in upgraded_results:
                assert expected_result_data[result.id] == result.file_path
コード例 #2
0
 def __init__(self):
     super(ImagePlugin, self).__init__('images', __default_settings__,
                                       ImageMediaItem, ImageTab)
     self.manager = Manager('images', init_schema)
     self.weight = -7
     self.icon_path = ':/plugins/plugin_images.png'
     self.icon = build_icon(self.icon_path)
コード例 #3
0
ファイル: customplugin.py プロジェクト: feitianyiren/openlp
 def __init__(self):
     super(CustomPlugin, self).__init__('custom', __default_settings__,
                                        CustomMediaItem, CustomTab)
     self.weight = -5
     self.db_manager = Manager('custom', init_schema)
     self.icon_path = ':/plugins/plugin_custom.png'
     self.icon = build_icon(self.icon_path)
コード例 #4
0
ファイル: songusageplugin.py プロジェクト: simhnna/openlp
 def __init__(self):
     super(SongUsagePlugin, self).__init__('songusage',
                                           __default_settings__)
     self.manager = Manager('songusage', init_schema, upgrade_mod=upgrade)
     self.weight = -4
     self.icon = UiIcons().song_usage
     self.song_usage_active = False
コード例 #5
0
 def __init__(self):
     super(SongUsagePlugin, self).__init__('songusage', __default_settings__)
     self.manager = Manager('songusage', init_schema, upgrade_mod=upgrade)
     self.weight = -4
     self.icon = build_icon(':/plugins/plugin_songusage.png')
     self.active_icon = build_icon(':/songusage/song_usage_active.png')
     self.inactive_icon = build_icon(':/songusage/song_usage_inactive.png')
     self.song_usage_active = False
コード例 #6
0
ファイル: songusageplugin.py プロジェクト: ipic/projecao
 def __init__(self):
     super(SongUsagePlugin, self).__init__('songusage')
     self.manager = Manager('songusage', init_schema, upgrade_mod=upgrade)
     self.weight = -4
     self.icon = UiIcons().song_usage
     self.song_usage_active = False
     State().add_service('song_usage', self.weight, is_plugin=True)
     State().update_pre_conditions('song_usage',
                                   self.check_pre_conditions())
コード例 #7
0
ファイル: imageplugin.py プロジェクト: simhnna/openlp
 def __init__(self):
     super(ImagePlugin, self).__init__('images', __default_settings__,
                                       ImageMediaItem, ImageTab)
     self.manager = Manager('images', init_schema, upgrade_mod=upgrade)
     self.weight = -7
     self.icon_path = UiIcons().picture
     self.icon = build_icon(self.icon_path)
     register_endpoint(images_endpoint)
     register_endpoint(api_images_endpoint)
コード例 #8
0
ファイル: customplugin.py プロジェクト: simhnna/openlp
 def __init__(self):
     super(CustomPlugin, self).__init__('custom', __default_settings__,
                                        CustomMediaItem, CustomTab)
     self.weight = -5
     self.db_manager = Manager('custom', init_schema)
     self.icon_path = UiIcons().clone
     self.icon = build_icon(self.icon_path)
     register_endpoint(custom_endpoint)
     register_endpoint(api_custom_endpoint)
コード例 #9
0
ファイル: imageplugin.py プロジェクト: ipic/projecao
 def __init__(self):
     super(ImagePlugin, self).__init__('images', ImageMediaItem, ImageTab)
     self.manager = Manager('images', init_schema, upgrade_mod=upgrade)
     self.weight = -7
     self.icon_path = UiIcons().picture
     self.icon = build_icon(self.icon_path)
     register_endpoint(images_endpoint)
     register_endpoint(api_images_endpoint)
     State().add_service('image', self.weight, is_plugin=True)
     State().update_pre_conditions('image', self.check_pre_conditions())
コード例 #10
0
 def __init__(self):
     """
     Create and set up the Songs plugin.
     """
     super(SongsPlugin, self).__init__('songs', __default_settings__,
                                       SongMediaItem, SongsTab)
     self.manager = Manager('songs', init_schema, upgrade_mod=upgrade)
     self.weight = -10
     self.icon_path = ':/plugins/plugin_songs.png'
     self.icon = build_icon(self.icon_path)
     self.songselect_form = None
コード例 #11
0
ファイル: customplugin.py プロジェクト: ipic/projecao
 def __init__(self):
     super(CustomPlugin, self).__init__('custom', CustomMediaItem,
                                        CustomTab)
     self.weight = -5
     self.db_manager = Manager('custom', init_schema)
     self.icon_path = UiIcons().clone
     self.icon = build_icon(self.icon_path)
     register_endpoint(custom_endpoint)
     register_endpoint(api_custom_endpoint)
     State().add_service(self.name, self.weight, is_plugin=True)
     State().update_pre_conditions(self.name, self.check_pre_conditions())
コード例 #12
0
 def __init__(self):
     """
     Class __init__ method
     """
     super(AlertsPlugin, self).__init__('alerts', __default_settings__, settings_tab_class=AlertsTab)
     self.weight = -3
     self.icon_path = ':/plugins/plugin_alerts.png'
     self.icon = build_icon(self.icon_path)
     AlertsManager(self)
     self.manager = Manager('alerts', init_schema)
     self.alert_form = AlertForm(self)
コード例 #13
0
ファイル: alertsplugin.py プロジェクト: simhnna/openlp
 def __init__(self):
     """
     Class __init__ method
     """
     super(AlertsPlugin, self).__init__('alerts',
                                        __default_settings__,
                                        settings_tab_class=AlertsTab)
     self.weight = -3
     self.icon_path = UiIcons().alert
     self.icon = self.icon_path
     AlertsManager(self)
     self.manager = Manager('alerts', init_schema)
     self.alert_form = AlertForm(self)
     register_endpoint(alerts_endpoint)
     register_endpoint(api_alerts_endpoint)
コード例 #14
0
 def __init__(self):
     """
     Class __init__ method
     """
     super(AlertsPlugin, self).__init__('alerts',
                                        settings_tab_class=AlertsTab)
     self.weight = -3
     self.icon_path = UiIcons().alert
     self.icon = self.icon_path
     AlertsManager(self)
     self.manager = Manager('alerts', init_schema)
     self.alert_form = AlertForm(self)
     register_endpoint(alerts_endpoint)
     register_endpoint(api_alerts_endpoint)
     State().add_service(self.name, self.weight, is_plugin=True)
     State().update_pre_conditions(self.name, self.check_pre_conditions())
コード例 #15
0
ファイル: songsplugin.py プロジェクト: ipic/projecao
 def __init__(self):
     """
     Create and set up the Songs plugin.
     """
     super(SongsPlugin, self).__init__('songs', SongMediaItem, SongsTab)
     self.manager = Manager('songs', init_schema, upgrade_mod=upgrade)
     self.weight = -10
     self.icon_path = UiIcons().music
     self.icon = build_icon(self.icon_path)
     self.songselect_form = None
     self.settings.extend_default_settings(song_footer)
     register_endpoint(songs_endpoint)
     register_endpoint(api_songs_endpoint)
     State().add_service(self.name, self.weight, is_plugin=True)
     State().update_pre_conditions(self.name, self.check_pre_conditions())
     if not self.settings.value('songs/last import type'):
         self.settings.setValue('songs/last import type',
                                SongFormat.OpenLyrics)