示例#1
0
 def GetValue( self ) -> HydrusNetwork.AccountType:
     
     title = self._title.text()
     
     permissions = {}
     
     for permission_control in self._permission_controls:
         
         ( content_type, action ) = permission_control.GetValue()
         
         if action is not None:
             
             permissions[ content_type ] = action
             
         
     
     bandwidth_rules = self._bandwidth_rules_control.GetValue()
     
     auto_creation_velocity = self._auto_create_velocity_control.GetValue()
     
     return HydrusNetwork.AccountType(
         account_type_key = self._account_type_key,
         title = title,
         permissions = permissions,
         bandwidth_rules = bandwidth_rules,
         auto_creation_velocity = auto_creation_velocity,
         auto_creation_history = self._auto_create_history
     )
示例#2
0
def ConvertToNewAccountType(account_type_key, title,
                            dictionary_string) -> HydrusNetwork.AccountType:

    dictionary = HydrusSerialisable.CreateFromString(dictionary_string)

    permissions = dict(dictionary['permissions'])
    bandwidth_rules = dictionary['bandwidth_rules']

    return HydrusNetwork.AccountType(account_type_key=account_type_key,
                                     title=title,
                                     permissions=permissions,
                                     bandwidth_rules=bandwidth_rules)