Пример #1
0
 def getExceptions(self, policy, category=None, categoryPolicy=None):
     """Convenience method to get the exception dict"""
     from lunchinator.privacy import PrivacySettings
     return PrivacySettings.get().getExceptions(self, category, policy, categoryPolicy=categoryPolicy)
Пример #2
0
 def getAskForConfirmation(self, category=None, categoryPolicy=None):
     """Convenience method to get the 'ask for confirmation' state"""
     from lunchinator.privacy import PrivacySettings
     return PrivacySettings.get().getAskForConfirmation(self, category, categoryPolicy=categoryPolicy)
Пример #3
0
 def getPeerState(self, peerID, category=None):
     """Convenience method to get the peer's privacy state"""
     from lunchinator.privacy import PrivacySettings
     return PrivacySettings.get().getPeerState(peerID, self, category)
Пример #4
0
 def getPrivacyPolicy(self, category=None, categoryPolicy=None):
     """Convenience method to get the privacy policy"""
     from lunchinator.privacy import PrivacySettings
     return PrivacySettings.get().getPolicy(self, category, categoryPolicy=categoryPolicy)
Пример #5
0
 def usesPrivacyCategories(self):
     """Returns True if the current privacy policy uses categories."""
     from lunchinator.privacy import PrivacySettings
     policy = PrivacySettings.get().getPolicy(self, None, categoryPolicy=PrivacySettings.CATEGORY_NEVER)
     return policy == PrivacySettings.POLICY_BY_CATEGORY
Пример #6
0
 def save_options_widget_data(self, **_kwargs):
     get_notification_center().disconnectPrivacySettingsChanged(self._settingsChanged)
     PrivacySettings.get().save()
     get_notification_center().connectPrivacySettingsChanged(self._settingsChanged)
     self._settingsChanged()
Пример #7
0
 def _settingsChanged(self, _=None, __=None):
     self.set_hidden_option(u"json", PrivacySettings.get().getJSON(), convert=False)
Пример #8
0
 def discard_changes(self):
     PrivacySettings.get().discard()
Пример #9
0
 def activate(self):
     iface_general_plugin.activate(self)
     PrivacySettings.initialize(self.hidden_options[u"json"])
     get_notification_center().connectPrivacySettingsChanged(self._settingsChanged)
Пример #10
0
    class TestAction(PeerAction):
        def getName(self):
            return "Test Action"
        
        def getIcon(self):
            from PyQt4.QtGui import QCommonStyle, QStyle
            style = QCommonStyle()
            return style.standardIcon(QStyle.SP_MessageBoxWarning)
        
        def getMessagePrefix(self):
            return "TEST"
        
        def getPrivacyCategories(self):
            return (u"Category 1", u"Category 2")
        
        def hasCategories(self):
            return True
        
        def getCategoryFromMessage(self, _msgData):
            return u"Category 1"
    
    initializeLogger()
    w = privacy()
    testAction = TestAction()
    testAction._pluginObject = w
    testAction._pluginName = "Test Plugin"
    PeerActions.get()._peerActions["Test Plugin"] = [testAction]
    w.run_options_widget()
    PrivacySettings.get().save(notify=False) # don't notify, no deadlock
    print PrivacySettings.get()._settings