minor changes

This commit is contained in:
Philip Ridout 2019-02-16 08:57:11 +00:00
parent 5a32b40653
commit bd99cee8fd
3 changed files with 0 additions and 9 deletions

View File

@ -173,9 +173,6 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
try: try:
web_config = get_web_page('{host}{name}'.format(host=self.web, name='download_3.0.json'), web_config = get_web_page('{host}{name}'.format(host=self.web, name='download_3.0.json'),
headers={'User-Agent': user_agent}) headers={'User-Agent': user_agent})
# web_config = Path(
# 'C:\\Users\\sroom\\Documents\\Phill Ridout\\play_ground\\openlp\\ftw-json\\download_3.0.json'
# ).read_text(encoding='utf-8') # TODO: Remove!!!!!
except ConnectionError: except ConnectionError:
QtWidgets.QMessageBox.critical(self, translate('OpenLP.FirstTimeWizard', 'Network Error'), QtWidgets.QMessageBox.critical(self, translate('OpenLP.FirstTimeWizard', 'Network Error'),
translate('OpenLP.FirstTimeWizard', 'There was a network error attempting ' translate('OpenLP.FirstTimeWizard', 'There was a network error attempting '
@ -192,18 +189,15 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
config = json.loads(web_config) config = json.loads(web_config)
meta = config['_meta'] meta = config['_meta']
self.web = meta['base_url'] self.web = meta['base_url']
self.songs_url = self.web + meta['songs_dir'] + '/' self.songs_url = self.web + meta['songs_dir'] + '/'
self.bibles_url = self.web + meta['bibles_dir'] + '/' self.bibles_url = self.web + meta['bibles_dir'] + '/'
self.themes_url = self.web + meta['themes_dir'] + '/' self.themes_url = self.web + meta['themes_dir'] + '/'
for song in config['songs'].values(): for song in config['songs'].values():
self.application.process_events() self.application.process_events()
item = QtWidgets.QListWidgetItem(song['title'], self.songs_list_widget) item = QtWidgets.QListWidgetItem(song['title'], self.songs_list_widget)
item.setData(QtCore.Qt.UserRole, (song['file_name'], song['sha256'])) item.setData(QtCore.Qt.UserRole, (song['file_name'], song['sha256']))
item.setCheckState(QtCore.Qt.Unchecked) item.setCheckState(QtCore.Qt.Unchecked)
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable) item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
for lang in config['bibles'].values(): for lang in config['bibles'].values():
self.application.process_events() self.application.process_events()
lang_item = QtWidgets.QTreeWidgetItem(self.bibles_tree_widget, [lang['title']]) lang_item = QtWidgets.QTreeWidgetItem(self.bibles_tree_widget, [lang['title']])
@ -215,7 +209,6 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable) item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
self.bibles_tree_widget.expandAll() self.bibles_tree_widget.expandAll()
self.application.process_events() self.application.process_events()
for theme in config['themes'].values(): for theme in config['themes'].values():
ThemeListWidgetItem(self.themes_url, theme, self, self.themes_list_widget) ThemeListWidgetItem(self.themes_url, theme, self, self.themes_list_widget)
self.application.process_events() self.application.process_events()

View File

@ -48,7 +48,6 @@ class TestThemeListWidgetItem(TestCase):
def setUp(self): def setUp(self):
self.sample_theme_data = {'file_name': 'BlueBurst.otz', 'sha256': 'sha_256_hash', self.sample_theme_data = {'file_name': 'BlueBurst.otz', 'sha256': 'sha_256_hash',
'thumbnail': 'BlueBurst.png', 'title': 'Blue Burst'} 'thumbnail': 'BlueBurst.png', 'title': 'Blue Burst'}
download_worker_patcher = patch('openlp.core.ui.firsttimeform.DownloadWorker') download_worker_patcher = patch('openlp.core.ui.firsttimeform.DownloadWorker')
self.addCleanup(download_worker_patcher.stop) self.addCleanup(download_worker_patcher.stop)
self.mocked_download_worker = download_worker_patcher.start() self.mocked_download_worker = download_worker_patcher.start()

View File

@ -36,7 +36,6 @@ class TestThemeListWidgetItem(TestCase, TestMixin):
def setUp(self): def setUp(self):
self.sample_theme_data = {'file_name': 'BlueBurst.otz', 'sha256': 'sha_256_hash', self.sample_theme_data = {'file_name': 'BlueBurst.otz', 'sha256': 'sha_256_hash',
'thumbnail': 'BlueBurst.png', 'title': 'Blue Burst'} 'thumbnail': 'BlueBurst.png', 'title': 'Blue Burst'}
Registry.create() Registry.create()
self.registry = Registry() self.registry = Registry()
mocked_app = MagicMock() mocked_app = MagicMock()