~raoul-snyman/openlp/fix-translations-2.4

« back to all changes in this revision

Viewing changes to openlp/core/__init__.py

  • Committer: Tim Bentley
  • Author(s): raoul at snyman
  • Date: 2016-12-18 13:53:03 UTC
  • mfrom: (2659.2.7 mac-niggles-2.4)
  • Revision ID: tim.bentley@gmail.com-20161218135303-yjl56q6qs9cwzge0
Fix bug #1645867 by setting an application attribute related to OpenGL
Set the width of the Theme wizard so that it doesn't resize by itself
Hide the splash screen when the backup dialog shows and when the exception form shows
Add icons back into the media library tabs

Add this to your merge proposal:
--------------------------------
lp:~raoul-snyman/openlp/mac-niggles-2.4 (revision 2666)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1875/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Fun...

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
            application_stylesheet += WIN_REPAIR_STYLESHEET
130
130
        if application_stylesheet:
131
131
            self.setStyleSheet(application_stylesheet)
132
 
        show_splash = Settings().value('core/show splash')
133
 
        if show_splash:
 
132
        can_show_splash = Settings().value('core/show splash')
 
133
        if can_show_splash:
134
134
            self.splash = SplashScreen()
135
135
            self.splash.show()
136
136
        # make sure Qt really display the splash screen
137
137
        self.processEvents()
138
138
        # Check if OpenLP has been upgrade and if a backup of data should be created
139
 
        self.backup_on_upgrade(has_run_wizard)
 
139
        self.backup_on_upgrade(has_run_wizard, can_show_splash)
140
140
        # start the main app window
141
141
        self.main_window = MainWindow()
142
142
        Registry().execute('bootstrap_initialise')
143
143
        Registry().execute('bootstrap_post_set_up')
144
144
        Registry().initialise = False
145
145
        self.main_window.show()
146
 
        if show_splash:
 
146
        if can_show_splash:
147
147
            # now kill the splashscreen
148
148
            self.splash.finish(self.main_window)
149
149
            log.debug('Splashscreen closed')
192
192
            self.exception_form = ExceptionForm()
193
193
        self.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exc_type, value, traceback)))
194
194
        self.set_normal_cursor()
 
195
        is_splash_visible = False
 
196
        if hasattr(self, 'splash') and self.splash.isVisible():
 
197
            is_splash_visible = True
 
198
            self.splash.hide()
195
199
        self.exception_form.exec()
 
200
        if is_splash_visible:
 
201
            self.splash.show()
196
202
 
197
 
    def backup_on_upgrade(self, has_run_wizard):
 
203
    def backup_on_upgrade(self, has_run_wizard, can_show_splash):
198
204
        """
199
205
        Check if OpenLP has been upgraded, and ask if a backup of data should be made
200
206
 
207
213
            Settings().setValue('core/application version', openlp_version)
208
214
        # If data_version is different from the current version ask if we should backup the data folder
209
215
        elif data_version != openlp_version:
 
216
            if self.splash.isVisible():
 
217
                self.splash.hide()
210
218
            if QtWidgets.QMessageBox.question(None, translate('OpenLP', 'Backup'),
211
219
                                              translate('OpenLP', 'OpenLP has been upgraded, do you want to create '
212
220
                                                                  'a backup of OpenLPs data folder?'),
228
236
                                                  % data_folder_backup_path)
229
237
            # Update the version in the settings
230
238
            Settings().setValue('core/application version', openlp_version)
 
239
            if can_show_splash:
 
240
                self.splash.show()
231
241
 
232
242
    def process_events(self):
233
243
        """
342
352
    application.setOrganizationName('OpenLP')
343
353
    application.setOrganizationDomain('openlp.org')
344
354
    application.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
 
355
    application.setAttribute(QtCore.Qt.AA_DontCreateNativeWidgetSiblings, True)
345
356
    if args and args.portable:
346
357
        application.setApplicationName('OpenLPPortable')
347
358
        Settings.setDefaultFormat(Settings.IniFormat)