diff options
| author | Brian Potchik <brian@vector35.com> | 2020-07-04 12:15:33 -0400 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2020-07-04 12:15:33 -0400 |
| commit | d34bd65478e02a5dc8d1e2f16f09ce7fcdafcb6d (patch) | |
| tree | c50a9d74aaad86297c09aa2a8ca982260128a20e | |
| parent | 5409fb4fc1e8727d74448286973243526c948fd3 (diff) | |
Workspace Settings are now Project Settings.
| -rw-r--r-- | binaryninjacore.h | 4 | ||||
| -rw-r--r-- | python/settings.py | 8 | ||||
| -rw-r--r-- | suite/api_test.py | 30 |
3 files changed, 21 insertions, 21 deletions
diff --git a/binaryninjacore.h b/binaryninjacore.h index b09a917a..a6e2c0c1 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -2238,8 +2238,8 @@ extern "C" SettingsAutoScope = 1, SettingsDefaultScope = 2, SettingsUserScope = 4, - SettingsWorkspaceScope = 8, - SettingsContextScope = 0x10 + SettingsProjectScope = 8, + SettingsResourceScope = 0x10 }; enum BNLinearViewObjectIdentifierType diff --git a/python/settings.py b/python/settings.py index e8e12fba..0bf0686f 100644 --- a/python/settings.py +++ b/python/settings.py @@ -54,8 +54,8 @@ class Settings(object): ================= ========================== ============== ================================ =============================== Default SettingsDefaultScope Lowest Settings Schema Settings Schema User SettingsUserScope - <User Directory>/settings.json <TBD> - Workspace SettingsWorkspaceScope - <TBD> <TBD> - Context SettingsContextScope Highest BinaryView (Storage in bndb) BinaryView (Storage in bndb) + Project SettingsProjectScope - <TBD> <TBD> + Resource SettingsResourceScope Highest BinaryView (Storage in BNDB) SettingsResource (Customizable) ================= ========================== ============== ================================ =============================== Individual settings are identified by a key, which is a string in the form of **'<group>.<name>'**. Groups provide a simple way \ @@ -101,9 +101,9 @@ class Settings(object): def set_resource_id(self, resource_id = None): """ ``set_resource_id`` Sets the resource identifier for this class:`Settings` instance. When accessing setting values at the \ - ``SettingsContextScope`` level, the resource identifier is passed along through the backing store interface. + ``SettingsResourceScope`` level, the resource identifier is passed along through the backing store interface. - .. note:: Currently the only available backing store for ``SettingsContextScope`` is a :class:`BinaryView` object. In the context \ + .. note:: Currently the only available backing store for ``SettingsResourceScope`` is a :class:`BinaryView` object. In the context \ of a :class:`BinaryView` the resource identifier is the :class:`BinaryViewType` name. All settings for this type of backing store \ are saved in the *'Raw'* :class:`BinaryViewType`. This enables the configuration of setting values such that they are available \ during :class:`BinaryView` creation and initialization. diff --git a/suite/api_test.py b/suite/api_test.py index 4fd1e0d7..91b19598 100644 --- a/suite/api_test.py +++ b/suite/api_test.py @@ -55,9 +55,9 @@ class SettingsAPI(unittest.TestCase): assert settings.register_setting("testGroup.stringSetting", '{"description" : "Test description.", "title" : "Test Title", "default" : "value", "type" : "string", "id" : "stringSetting"}'), "test_settings_types failed" assert not settings.register_setting("testGroup.stringListSetting", '{"description" : "Test description.", "title" : "Test Title", "default" : true, "type" : "array", "id" : "stringListSetting"}'), "test_settings_types failed" assert settings.register_setting("testGroup.stringListSetting", '{"description" : "Test description.", "title" : "Test Title", "default" : ["value1", "value2"], "type" : "array", "id" : "stringListSetting"}'), "test_settings_types failed" - assert settings.register_setting("testGroup.ignoreContextBoolSetting", '{"description" : "Test description.", "title" : "Test Title", "default" : true, "type" : "boolean", "id" : "boolSetting", "ignore" : ["Context"]}'), "test_settings_types failed" - assert settings.register_setting("testGroup.ignoreUserBoolSetting", '{"description" : "Test description.", "title" : "Test Title", "default" : true, "type" : "boolean", "id" : "boolSetting", "ignore" : ["User"]}'), "test_settings_types failed" - assert settings.register_setting("testGroup.readOnlyBoolSetting", '{"description" : "Test description.", "title" : "Test Title", "default" : true, "type" : "boolean", "id" : "boolSetting", "ignore" : ["Context", "User"]}'), "test_settings_types failed" + assert settings.register_setting("testGroup.ignoreResourceBoolSetting", '{"description" : "Test description.", "title" : "Test Title", "default" : true, "type" : "boolean", "id" : "boolSetting", "ignore" : ["SettingsResourceScope"]}'), "test_settings_types failed" + assert settings.register_setting("testGroup.ignoreUserBoolSetting", '{"description" : "Test description.", "title" : "Test Title", "default" : true, "type" : "boolean", "id" : "boolSetting", "ignore" : ["SettingsUserScope"]}'), "test_settings_types failed" + assert settings.register_setting("testGroup.readOnlyBoolSetting", '{"description" : "Test description.", "title" : "Test Title", "default" : true, "type" : "boolean", "id" : "boolSetting", "ignore" : ["SettingsResourceScope", "SettingsUserScope"]}'), "test_settings_types failed" assert settings.contains("testGroup.boolSetting"), "test_settings_types failed" assert settings.contains("testGroup.doubleSetting"), "test_settings_types failed" @@ -96,15 +96,15 @@ class SettingsAPI(unittest.TestCase): assert settings.get_string_list_with_scope("testGroup.stringListSetting", scope=SettingsScope.SettingsUserScope)[0] == ["value3", "value4"], "test_settings_types failed" raw_view = BinaryView.new(b'0x55') - assert not settings.set_bool("testGroup.ignoreContextBoolSetting", False, scope=SettingsScope.SettingsDefaultScope), "test_settings_types failed" - assert not settings.set_bool("testGroup.ignoreContextBoolSetting", False, scope=SettingsScope.SettingsContextScope), "test_settings_types failed" - assert not settings.set_bool("testGroup.ignoreContextBoolSetting", False, raw_view, scope=SettingsScope.SettingsContextScope), "test_settings_types failed" - assert settings.set_bool("testGroup.ignoreContextBoolSetting", False, scope=SettingsScope.SettingsUserScope), "test_settings_types failed" + assert not settings.set_bool("testGroup.ignoreResourceBoolSetting", False, scope=SettingsScope.SettingsDefaultScope), "test_settings_types failed" + assert not settings.set_bool("testGroup.ignoreResourceBoolSetting", False, scope=SettingsScope.SettingsResourceScope), "test_settings_types failed" + assert not settings.set_bool("testGroup.ignoreResourceBoolSetting", False, raw_view, scope=SettingsScope.SettingsResourceScope), "test_settings_types failed" + assert settings.set_bool("testGroup.ignoreResourceBoolSetting", False, scope=SettingsScope.SettingsUserScope), "test_settings_types failed" assert not settings.set_bool("testGroup.ignoreUserBoolSetting", False), "test_settings_types failed" assert settings.set_bool("testGroup.ignoreUserBoolSetting", False, raw_view), "test_settings_types failed" - assert settings.set_bool("testGroup.ignoreUserBoolSetting", False, raw_view, scope=SettingsScope.SettingsContextScope), "test_settings_types failed" + assert settings.set_bool("testGroup.ignoreUserBoolSetting", False, raw_view, scope=SettingsScope.SettingsResourceScope), "test_settings_types failed" assert not settings.set_bool("testGroup.readOnlyBoolSetting", False), "test_settings_types failed" - assert not settings.set_bool("testGroup.readOnlyBoolSetting", False, scope=SettingsScope.SettingsContextScope), "test_settings_types failed" + assert not settings.set_bool("testGroup.readOnlyBoolSetting", False, scope=SettingsScope.SettingsResourceScope), "test_settings_types failed" assert not settings.set_bool("testGroup.readOnlyBoolSetting", False, scope=SettingsScope.SettingsUserScope), "test_settings_types failed" s2 = Settings("test2") @@ -119,7 +119,7 @@ class SettingsAPI(unittest.TestCase): assert s2.get_string("testGroup.stringSetting") == "value", "test_settings_types failed" assert s2.get_string_list("testGroup.stringListSetting") == ["value1", "value2"], "test_settings_types failed" - assert s2.deserialize_settings(settings.serialize_settings(scope = SettingsScope.SettingsUserScope), raw_view, SettingsScope.SettingsContextScope), "test_settings_types failed" + assert s2.deserialize_settings(settings.serialize_settings(scope = SettingsScope.SettingsUserScope), raw_view, SettingsScope.SettingsResourceScope), "test_settings_types failed" assert s2.get_bool("testGroup.boolSetting", raw_view) == False, "test_settings_types failed" assert s2.get_double("testGroup.doubleSetting", raw_view) == 700, "test_settings_types failed" assert s2.get_integer("testGroup.integerSetting", raw_view) == 700, "test_settings_types failed" @@ -134,19 +134,19 @@ class SettingsAPI(unittest.TestCase): assert s2.get_string_list("testGroup.stringListSetting") == ["value1", "value2"], "test_settings_types failed" s3 = Settings("test3") - assert s3.deserialize_schema(test_schema, SettingsScope.SettingsContextScope) - assert not s3.contains("testGroup.ignoreContextBoolSetting"), "test_settings_types failed" + assert s3.deserialize_schema(test_schema, SettingsScope.SettingsResourceScope) + assert not s3.contains("testGroup.ignoreResourceBoolSetting"), "test_settings_types failed" assert s3.contains("testGroup.ignoreUserBoolSetting"), "test_settings_types failed" assert not s3.contains("testGroup.readOnlyBoolSetting"), "test_settings_types failed" assert s3.deserialize_schema(test_schema, SettingsScope.SettingsUserScope, False) - assert s3.contains("testGroup.ignoreContextBoolSetting"), "test_settings_types failed" + assert s3.contains("testGroup.ignoreResourceBoolSetting"), "test_settings_types failed" assert not s3.contains("testGroup.ignoreUserBoolSetting"), "test_settings_types failed" assert not s3.contains("testGroup.readOnlyBoolSetting"), "test_settings_types failed" assert s3.deserialize_schema(test_schema, SettingsScope.SettingsUserScope, False) - assert s3.deserialize_schema(s3.serialize_schema(), SettingsScope.SettingsContextScope, False) - assert not s3.contains("testGroup.ignoreContextBoolSetting"), "test_settings_types failed" + assert s3.deserialize_schema(s3.serialize_schema(), SettingsScope.SettingsResourceScope, False) + assert not s3.contains("testGroup.ignoreResourceBoolSetting"), "test_settings_types failed" assert not s3.contains("testGroup.ignoreUserBoolSetting"), "test_settings_types failed" assert not s3.contains("testGroup.readOnlyBoolSetting"), "test_settings_types failed" |
