Changeset 4198 for trunk/umitInventory/TLChangesTree.py
- Timestamp:
- 02/24/09 23:23:20 (4 years ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
. (modified) (1 prop)
-
umitInventory/TLChangesTree.py (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svnmerge-integrated changed from /branch/InterfaceEditor:1-4032 /branch/NetworkInventory:1-3849,3851-3864,3876-3919,3921-3948,3953-3955,3957-4191 /branch/UmitPlugins:1-2993,2997-2998,3008,3010-3011,3013-3015,3029-3031,3034-3073,3077-3086,3088,3091-3092,3098-3100,3105-3108,3110,3112,3120-3125,3128,3130-3131,3133,3135-3141,3143-3151,3153-3232,3234-3789,3792-4112 to /branch/InterfaceEditor:1-4032 /branch/NetworkInventory:1-3849,3851-3864,3876-3919,3921-3948,3953-3955,3957-4197 /branch/UmitPlugins:1-2993,2997-2998,3008,3010-3011,3013-3015,3029-3031,3034-3073,3077-3086,3088,3091-3092,3098-3100,3105-3108,3110,3112,3120-3125,3128,3130-3131,3133,3135-3141,3143-3151,3153-3232,3234-3789,3792-4112
-
trunk/umitInventory/TLChangesTree.py
r4097 r4198 23 23 from umitCore.I18N import _ 24 24 25 from umitInventory.TLBase import categories 26 25 27 ALLCHANGES = _("View all changes") 26 28 LISTCHANGES = _("Changes listing") … … 31 33 """ 32 34 33 def __init__(self, connector, datagrabber, categories, inventory,35 def __init__(self, connector, datagrabber, db_categories, inventory, 34 36 hostaddr): 35 37 … … 38 40 self.connector = connector 39 41 self.datagrabber = datagrabber 40 self. categories =categories42 self.db_categories = db_categories 41 43 self.inventory = inventory 42 44 self.hostaddr = hostaddr … … 66 68 # startup situation 67 69 self.treestore.append(None, [ALLCHANGES]) 68 for category in self. categories:69 self.treestore.append(None, ["%s (0)" % categor y])70 for category in self.db_categories: 71 self.treestore.append(None, ["%s (0)" % categories[category]]) 70 72 71 73 … … 85 87 86 88 elif len(path) == 2: 87 # clicked on View all changesinside a category89 # clicked on "View all changes" inside a category 88 90 category_id = path[0] 89 91 category_load = { } … … 142 144 Grabs changes from range_start to range_end and then update tree. 143 145 """ 144 categories = self.datagrabber.get_categories()145 self. categories = [value[1] for key, value incategories.items()]146 db_categories = self.datagrabber.get_categories() 147 self.db_categories = [value[1] for key, value in db_categories.items()] 146 148 147 149 data = { } … … 149 151 # grab changes in timerange 150 152 self.datagrabber.use_dict_cursor() 151 for key in categories.keys():153 for key in db_categories.keys(): 152 154 if not range_start or not range_end: 153 155 data[key] = { } … … 190 192 191 193 # update clean_data 192 #if clean_data[category].has_key(inventories[fk_inventory]):193 194 if inventories[fk_inventory] in clean_data[category]: 194 195 cdata = clean_data[category][inventories[fk_inventory]] 195 196 196 #if cdata.has_key(addresses[fk_address]):197 197 if addresses[fk_address] in cdata: 198 198 cdata[addresses[fk_address]] += 1 … … 213 213 self.treestore.append(None, [ALLCHANGES]) 214 214 215 for indx, item in enumerate(self. categories):216 data_leng ht= len(data[indx + 1]) # keys starting at 1217 changes_sum += data_leng ht218 219 root = self.treestore.append(None, ["%s (%d)" % ( item,220 data_leng ht)])221 222 if data_leng ht> 0:215 for indx, item in enumerate(self.db_categories): 216 data_length = len(data[indx + 1]) # keys starting at 1 217 changes_sum += data_length 218 219 root = self.treestore.append(None, ["%s (%d)" % (categories[item], 220 data_length)]) 221 222 if data_length > 0: 223 223 self.treestore.append(root, [ALLCHANGES]) 224 224
