Beispiel #1
0
    def on_preferences(self, event):
        """Creates and shows :class:`dialogs.PreferencesDialog` to edit the
        configuration parameters.

        :param event: Event entailed execution of the callback
        :type event: :class:`wx.CommandEvent` with type :const:`wx.EVT_MENU`

        """
        dialog = PreferencesDialog(player=self)
        if dialog.ShowModal() == wx.ID_OK:
            wx.PostEvent(
                self,
                ev.ConfigUpdate(params=dialog.get_preferences(),
                                apply_updated=True))
            self._filters = dialog.get_filters()
            self.app.dump_filters(self._filters)
        dialog.Destroy()
Beispiel #2
0
    def on_preferences(self):
        """Preferences event handler (:class:`dialogs.PreferencesDialog`) """

        data = PreferencesDialog(self).data

        if data is not None:
            max_file_history_changed = \
                self.settings.max_file_history != data['max_file_history']

            # Dialog has been approved --> Store data to settings
            for key in data:
                if key == "signature_key" and not data[key]:
                    data[key] = genkey()
                self.settings.__setattr__(key, data[key])

            # Immediately adjust file history in menu
            if max_file_history_changed:
                self.menuBar().file_menu.history_submenu.update()
Beispiel #3
0
 def preferences_menu_item_activate(self, menu_item):
     """Show the preferences dialog."""
     pd = PreferencesDialog(self.config)
     pd.dialog.show()