Esempio n. 1
0
class privacy(iface_general_plugin):
    def __init__(self):
        super(privacy, self).__init__()
        self._ui = None
        self._modified = False
        self.force_activation = True
        self.hidden_options = {u"json" : u"{}"}
        
    def activate(self):
        iface_general_plugin.activate(self)
        PrivacySettings.initialize(self.hidden_options[u"json"])
        get_notification_center().connectPrivacySettingsChanged(self._settingsChanged)
        
    def deactivate(self):
        get_notification_center().disconnectPrivacySettingsChanged(self._settingsChanged)
        iface_general_plugin.deactivate(self)

    def has_options_widget(self):
        return True

    def create_options_widget(self, parent):
        from privacy_gui.gui import PrivacyGUI
        self._ui = PrivacyGUI(parent, self.logger)
        return self._ui  
    
    def destroy_options_widget(self):
        self._ui.finish()
        iface_general_plugin.destroy_options_widget(self)
    
    def get_displayed_name(self):
        return u"Privacy"
    
    def discard_changes(self):
        PrivacySettings.get().discard()
        
    @loggingFunc
    def _settingsChanged(self, _=None, __=None):
        self.set_hidden_option(u"json", PrivacySettings.get().getJSON(), convert=False)
        
    def save_options_widget_data(self, **_kwargs):
        get_notification_center().disconnectPrivacySettingsChanged(self._settingsChanged)
        PrivacySettings.get().save()
        get_notification_center().connectPrivacySettingsChanged(self._settingsChanged)
        self._settingsChanged()
Esempio n. 2
0
 def create_options_widget(self, parent):
     from privacy_gui.gui import PrivacyGUI
     self._ui = PrivacyGUI(parent, self.logger)
     return self._ui