Example #1
0
    def _handle_page_closing(self, event):
        # Veto the event, page deletion is managed explicitly later
        event.Veto()

        if core_api.block_databases():
            page = self.GetCurrentPage()
            databases.close_database(page.get_filename())
            core_api.release_databases()
Example #2
0
    def _proceed(self, event):
        # Close the properties tab explicitly, otherwise if the closing is
        # aborted, the choice controls should be reset to the current
        # configuration, if the tab is still open, which is not necessarily
        # true because the closing of the properties tab would race e.g. with
        # the dialogs to save the database
        self.propmanager.close(self.filename)

        if databases.close_database(self.filename):
            shutil.copy2(self.filename, self.backup.GetPath())

            if self.value == 0:
                dbdeps.Database(self.filename).add((self.ext, ))
            elif self.value == 1:
                dbdeps.Database(self.filename).remove((self.ext, ))
            else:
                dbdeps.Database(self.filename).remove((self.ext, ),
                                                      ignored=True)

            # Use CallAfter or segfaults may happen
            wx.CallAfter(databases.open_database,
                         self.filename,
                         open_properties=True)
            # Note that no other operation should be done on the database
            #  directly here, because opening the database may fail e.g.
            #  because of the compatibility checks
        else:
            self.propmanager.open(self.filename)

        # Always close the dialog because the property settings have been
        # reset by closing and reopening the property tab
        self._close()
Example #3
0
    def _proceed(self, event):
        # Close the properties tab explicitly, otherwise if the closing is
        # aborted, the choice controls should be reset to the current
        # configuration, if the tab is still open, which is not necessarily
        # true because the closing of the properties tab would race e.g. with
        # the dialogs to save the database
        self.propmanager.close(self.filename)

        if databases.close_database(self.filename):
            shutil.copy2(self.filename, self.backup.GetPath())

            if self.value == 0:
                dbdeps.Database(self.filename).add((self.ext, ))
            elif self.value == 1:
                dbdeps.Database(self.filename).remove((self.ext, ))
            else:
                dbdeps.Database(self.filename).remove((self.ext, ),
                                                                ignored=True)

            # Use CallAfter or segfaults may happen
            wx.CallAfter(databases.open_database, self.filename,
                                                        open_properties=True)
            # Note that no other operation should be done on the database
            #  directly here, because opening the database may fail e.g.
            #  because of the compatibility checks
        else:
            self.propmanager.open(self.filename)

        # Always close the dialog because the property settings have been
        # reset by closing and reopening the property tab
        self._close()