comparisonSettings.py (1897B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\comparison\comparisonSettings.py 2 from carbon.common.script.sys.serviceConst import ROLE_QA 3 from clientsettings.setting import UserSettingBool, UserSettingEnum 4 from itertoolsext.Enum import enum 5 from signals import Signal 6 use_new_comparison_tool = UserSettingBool('use_new_compare_tool_feature_v02', True) 7 only_show_diffrentiators_setting = UserSettingBool('compare_onlyShowDifferent', False) 8 9 @enum 10 11 class ViewMode: 12 horizontal = 1 13 vertical = 2 14 15 16 view_mode_setting = UserSettingEnum('compare_viewMode', ViewMode.vertical, ViewMode.values()) 17 18 class AttributeBlacklist(list): 19 20 def __init__(self, *args): 21 super(AttributeBlacklist, self).__init__(*args) 22 self.on_attribute_added = Signal('AttributeBlacklist.on_attribute_added') 23 self.on_attribute_removed = Signal('AttributeBlacklist.on_attribute_removed') 24 self.on_cleared = Signal('AttributeBlacklist.on_cleared') 25 26 def toggle_attribute(self, attribute_id): 27 if attribute_id in self: 28 self.remove(attribute_id) 29 self.on_attribute_removed() 30 else: 31 self.append(attribute_id) 32 self.on_attribute_added() 33 34 def add_attributes(self, attribute_ids): 35 for attribute_id in attribute_ids: 36 if attribute_id not in self: 37 self.append(attribute_id) 38 39 self.on_attribute_added() 40 41 def toggle_show_all(self, attribute_ids): 42 is_showing_all = not self and not only_show_diffrentiators_setting.is_enabled() 43 if is_showing_all: 44 self.add_attributes(attribute_ids) 45 else: 46 only_show_diffrentiators_setting.disable() 47 self.clear() 48 49 def clear(self): 50 if self: 51 self[:] = [] 52 self.on_cleared() 53 54 55 attribute_blacklist = AttributeBlacklist()