~trb143/openlp/broken_search

« back to all changes in this revision

Viewing changes to openlp/core/ui/maindisplay.py

  • Committer: Tomas Groth
  • Author(s): tomasgroth at yahoo
  • Date: 2015-10-15 20:52:13 UTC
  • mfrom: (2558.2.1 closeevent)
  • Revision ID: tomasgroth@yahoo.dk-20151015205213-3hshyb32k9mzmf4d
Ignore close event in maindisplay unless it is trigger by OpenLP itself. Ignores ALT+F4 on windows.

Show diffs side-by-side

added added

removed removed

Lines of Context:
173
173
            Registry().register_function('live_display_hide', self.hide_display)
174
174
            Registry().register_function('live_display_show', self.show_display)
175
175
            Registry().register_function('update_display_css', self.css_changed)
 
176
        self.close_display = False
 
177
 
 
178
    def closeEvent(self, event):
 
179
        """
 
180
        Catch the close event, and check that the close event is triggered by OpenLP closing the display.
 
181
        On Windows this event can be triggered by pressing ALT+F4, which we want to ignore.
 
182
 
 
183
        :param event: The triggered event
 
184
        """
 
185
        if self.close_display:
 
186
            super().closeEvent(event)
 
187
        else:
 
188
            event.ignore()
176
189
 
177
190
    def close(self):
178
191
        """
182
195
            Registry().remove_function('live_display_hide', self.hide_display)
183
196
            Registry().remove_function('live_display_show', self.show_display)
184
197
            Registry().remove_function('update_display_css', self.css_changed)
 
198
        self.close_display = True
185
199
        super().close()
186
200
 
187
201
    def set_transparency(self, enabled):