Changeset 1431
- Timestamp:
- 08/19/07 04:05:09 (6 years ago)
- Location:
- branch/ggpolo
- Files:
-
- 14 modified
-
umitDB/InventoryChanges.py (modified) (17 diffs)
-
umitDB/Retrieve.py (modified) (4 diffs)
-
umitDB/Store.py (modified) (33 diffs)
-
umitDB/XMLStore.py (modified) (3 diffs)
-
umitDBUpdates/insert-changes-into-db.py (modified) (3 diffs)
-
umitInventory/About.py (modified) (2 diffs)
-
umitInventory/ChangesDiff.py (modified) (3 diffs)
-
umitInventory/ChangesList.py (modified) (2 diffs)
-
umitInventory/DataGrabber.py (modified) (3 diffs)
-
umitInventory/InventoryLoad.py (modified) (2 diffs)
-
umitInventory/SearchBar.py (modified) (1 diff)
-
umitInventory/Timeline.py (modified) (3 diffs)
-
umitInventory/Version.py (modified) (1 diff)
-
umitInventory/Viewer.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branch/ggpolo/umitDB/InventoryChanges.py
r1382 r1431 20 20 from umitCore.I18N import _ 21 21 22 from umitDB.Connection import ConnectDB 22 23 from umitDB.Store import RawStore 23 24 from umitDB.Retrieve import InventoryRetrieve … … 26 27 pass 27 28 28 class UpdateChanges(InventoryRetrieve, RawStore):29 class ConnectToUpdate(ConnectDB, InventoryRetrieve, RawStore): 29 30 """ 30 Updates list of changes for a given Inventory id. 31 You should use this when doing inventory changes update exclusively 32 in database. 31 33 """ 32 33 def __init__(self, database , fk_inventory=None):34 35 InventoryRetrieve.__init__(self, database)34 35 def __init__(self, database): 36 ConnectDB.__init__(self, database) 37 InventoryRetrieve.__init__(self, self.conn, self.cursor) 36 38 RawStore.__init__(self, self.conn, self.cursor) 39 40 41 class UpdateChanges: 42 """ 43 Updates/creates list of changes for Inventory. 44 """ 45 46 def __init__(self, invdb, fk_inventory=None): 47 48 self.invdb = invdb 37 49 self.fk_inventory = fk_inventory 38 50 … … 49 61 50 62 # get scan ids and finish time for especified inventory 51 finish_data = self.get_finish_data_for_inventory_from_db(inv_id) 52 53 63 finish_data = self.invdb.get_finish_data_for_inventory_from_db(inv_id) 64 54 65 # retrieve host addresses for especified inventory id 55 66 for scan in finish_data: 56 67 # retrieve host ids for each scan 57 for host in self. get_hosts_id_for_scan_from_db(scan[0]):68 for host in self.invdb.get_hosts_id_for_scan_from_db(scan[0]): 58 69 # retrieve ipv4 address for host 59 addr = self. get_ipv4_for_host_from_db(host[0])70 addr = self.invdb.get_ipv4_for_host_from_db(host[0]) 60 71 61 72 if addr in addresses: … … 63 74 64 75 addresses.append(addr) 65 66 76 67 77 # generate changes list for each address in especified inventory 68 78 for addr in addresses: … … 70 80 # get all host pks for especified inventory and for each address 71 81 # in addresses 72 base_data = self. get_hosts_base_data_for_inventory_from_db(addr,82 base_data = self.invdb.get_hosts_base_data_for_inventory_from_db(addr, 73 83 inv_id) 74 84 … … 105 115 date = finish_data[indexes[0]][1] 106 116 hostA = base_data[0] 107 self. use_dict_cursor()108 pdata1 = self. get_portid_and_state_for_host_from_db(hostA[1])109 self. use_standard_cursor()110 fpinfo1 = self. get_fingerprint_info_for_host_from_db(hostA[1])111 osmatch1 = self. get_osmatch_for_host_from_db(hostA[1])112 osclasses1 = self. get_osclasses_for_host_from_db(hostA[1])113 pcdata1 = self. get_portid_and_fks_for_host_from_db(hostA[1])117 self.invdb.use_dict_cursor() 118 pdata1 = self.invdb.get_portid_and_state_for_host_from_db(hostA[1]) 119 self.invdb.use_standard_cursor() 120 fpinfo1 = self.invdb.get_fingerprint_info_for_host_from_db(hostA[1]) 121 osmatch1 = self.invdb.get_osmatch_for_host_from_db(hostA[1]) 122 osclasses1 = self.invdb.get_osclasses_for_host_from_db(hostA[1]) 123 pcdata1 = self.invdb.get_portid_and_fks_for_host_from_db(hostA[1]) 114 124 115 125 host_count = 1 … … 120 130 121 131 # load data to compare against hostA 122 self. use_dict_cursor()123 pdata2 = self. get_portid_and_state_for_host_from_db(hostB[1])124 self. use_standard_cursor()125 fpinfo2 = self. get_fingerprint_info_for_host_from_db(hostB[1])126 osmatch2 = self. get_osmatch_for_host_from_db(hostB[1])127 osclasses2 = self. get_osclasses_for_host_from_db(hostB[1])128 pcdata2 = self. get_portid_and_fks_for_host_from_db(hostB[1])132 self.invdb.use_dict_cursor() 133 pdata2 = self.invdb.get_portid_and_state_for_host_from_db(hostB[1]) 134 self.invdb.use_standard_cursor() 135 fpinfo2 = self.invdb.get_fingerprint_info_for_host_from_db(hostB[1]) 136 osmatch2 = self.invdb.get_osmatch_for_host_from_db(hostB[1]) 137 osclasses2 = self.invdb.get_osclasses_for_host_from_db(hostB[1]) 138 pcdata2 = self.invdb.get_portid_and_fks_for_host_from_db(hostB[1]) 129 139 130 140 # compare old data against new data … … 169 179 170 180 # insert data into database 171 fk_address = self. get_address_id_for_address_from_db(addr_id)181 fk_address = self.invdb.get_address_id_for_address_from_db(addr_id) 172 182 for key in dict_keys: 173 183 affected = data_dict[key][0] … … 178 188 179 189 # check if category 'affected' already exists on database 180 fk_category = self. get_inventory_change_category_id(affected)190 fk_category = self.invdb.get_inventory_change_category_id(affected) 181 191 if not fk_category: 182 192 # didn't exist, create it now 183 self.in sert_inventory_change_category_db(affected)184 fk_category = self. get_id_for("inventory_change_category")193 self.invdb.insert_inventory_change_category_db(affected) 194 fk_category = self.invdb.get_id_for("inventory_change_category") 185 195 186 196 # check if comparison is already in database 187 197 # (this should have been done at earlier stage, but for now 188 198 # it is being done here) 189 ret = self. get_inventory_comparison(old_hostid, new_hostid,190 date, inventory_id)199 ret = self.invdb.get_inventory_comparison(old_hostid, new_hostid, 200 date, inventory_id) 191 201 192 202 if not ret: 193 203 # need to insert new comparison 194 self.in sert_inventory_comparison_db(old_hostid, new_hostid,204 self.invdb.insert_inventory_comparison_db(old_hostid, new_hostid, 195 205 date, text, inventory_id, 196 206 fk_category, fk_address) 197 207 198 208 199 209 def _compare_data(self, pdata2, fpinfo2, osmatch2, osclasses2, pcdata2, … … 209 219 # compare pdataNs 210 220 if pdata1 != pdata2: 211 host_diff += self._ports_diff(pdata2, pdata1)221 host_diff = self._ports_diff(pdata2, pdata1) 212 222 fp_only = False 213 223 ports_only = True … … 219 229 new_ports = { } 220 230 221 self. use_dict_cursor()231 self.invdb.use_dict_cursor() 222 232 for pd in pcdata2: 223 fpd = self.get_port_data_for_pdata_from_db(pd[2], pd[3], pd[1]) 233 fpd = self.invdb.get_port_data_for_pdata_from_db(pd[2], pd[3], 234 pd[1]) 224 235 old_ports[pd[0]] = fpd 225 236 226 237 for pd in pcdata1: 227 fpd = self.get_port_data_for_pdata_from_db(pd[2], pd[3], pd[1]) 238 fpd = self.invdb.get_port_data_for_pdata_from_db(pd[2], pd[3], 239 pd[1]) 228 240 new_ports[pd[0]] = fpd 229 self. use_standard_cursor()241 self.invdb.use_standard_cursor() 230 242 231 243 info_changes = [ ] … … 241 253 verb, plural = self.conjugate(info_changes, False) 242 254 ports_str = ', '.join([str(p) for p in info_changes]) 243 host_diff += _("Port%s %s %s changed info!" % (plural, ports_str, 244 verb)) 255 host_diff = ''.join([host_diff, 256 _("Port%s %s %s changed info!" % (plural, 257 ports_str, verb))]) 245 258 246 259 # compare fpinfoNs … … 257 270 if osmatch1 != osmatch2: 258 271 space = host_diff and ' ' or '' 259 common_text += _("OS Match, ")272 common_text = ''.join([common_text, _("OS Match, ")]) 260 273 fp_only = False 261 274 ports_only = False … … 265 278 space = host_diff and ' ' or '' 266 279 if len(common_text) == len("Fingerprint, "): 267 common_text = common_text[:-2] + " "280 common_text = ''.join([common_text[:-2], " "]) 268 281 if common_text: 269 common_text += _("and OS Classes")282 common_text = ''.join([common_text, _("and OS Classes")]) 270 283 else: 271 common_text += _("OS Classes")284 common_text = ''.join([common_text, _("OS Classes")]) 272 285 fp_only = False 273 286 ports_only = False … … 276 289 if fp_only or len(common_text) == len(" Fingerprint, "): 277 290 common_text = common_text[:-2] 278 host_diff += common_text + _(" changed.") 291 292 host_diff = ''.join([host_diff, common_text, _(" changed.")]) 279 293 280 294 # check diff … … 377 391 378 392 if open_ports and closed_ports: 379 text = open_ports[:-1 -len(now_text) -1] + ' ' + and_text + \380 ' ' + closed_ports393 text = ' '.join([open_ports[:-1 -len(now_text) -1], and_text, 394 closed_ports]) 381 395 elif open_ports: 382 396 text = open_ports … … 416 430 """ 417 431 418 def __init__(self, database):419 InventoryRetrieve.__init__(self, database)432 def __init__(self, conn, cursor): 433 InventoryRetrieve.__init__(self, conn, cursor) 420 434 421 435 -
branch/ggpolo/umitDB/Retrieve.py
r1404 r1431 350 350 Expects a conn and cursor from database connection. 351 351 """ 352 self.conn = conn 353 self.cursor = cursor 354 355 RawRetrieve.__init__(self, self.conn, self.cursor) 352 RawRetrieve.__init__(self, conn, cursor) 356 353 357 354 … … 617 614 618 615 return classes 619 620 621 class InventoryRetrieve(Co nnectDB, CompositeRetrieve):616 617 618 class InventoryRetrieve(CompositeRetrieve): 622 619 """ 623 620 Retrieves inventory data from database. 624 621 """ 625 622 626 def __init__(self, db): 627 """ 628 Expects an umit database. 629 """ 630 ConnectDB.__init__(self, db) 631 CompositeRetrieve.__init__(self, self.conn, self.cursor) 623 def __init__(self, conn, cursor): 624 CompositeRetrieve.__init__(self, conn, cursor) 632 625 633 626 … … 823 816 824 817 return changes 825 818 819 826 820 def get_inventory_changes_for_category(self, fk_inventory, fk_address, 827 821 fk_category): … … 862 856 863 857 return changes 864 858 859 860 class ConnectInventoryDB(ConnectDB, InventoryRetrieve): 861 """ 862 This replaces the previous UpdateChanges class in InventoryChanges module. 863 ToDo: Write a better doc =) 864 """ 865 866 def __init__(self, db): 867 ConnectDB.__init__(self, db) 868 InventoryRetrieve.__init__(self, self.conn, self.cursor) 869 -
branch/ggpolo/umitDB/Store.py
r1400 r1431 55 55 scan_d["hosts_down"], scan_d["scanner"])) 56 56 57 self.conn.commit()58 59 57 60 58 def insert_scaninfo_db(self, scaninfo): … … 69 67 scaninfo["services"], scaninfo["fk_scan"], 70 68 scaninfo["type"], scaninfo["protocol"])) 71 self.conn.commit()72 69 73 70 … … 80 77 self.cursor.execute("INSERT INTO scan_type (name) VALUES \ 81 78 (?)", (scan_name, )) 82 self.conn.commit()83 79 84 80 … … 91 87 self.cursor.execute("INSERT INTO scanner (name, version) VALUES \ 92 88 (?, ?)", (scanner_name, scanner_version)) 93 self.conn.commit()94 89 95 90 … … 105 100 (portid, service_info_id, protocol_id, 106 101 port_state_id)) 107 self.conn.commit()108 102 109 103 … … 116 110 self.cursor.execute("INSERT INTO port_state (state) VALUES \ 117 111 (?)", (port_state, )) 118 self.conn.commit()119 112 120 113 … … 127 120 self.cursor.execute("INSERT INTO protocol (name) VALUES \ 128 121 (?)", (protocol, )) 129 self.conn.commit()130 122 131 123 … … 138 130 self.cursor.execute("INSERT INTO _host_port (fk_host, fk_port) \ 139 131 VALUES (?, ?)", (fk_host, fk_port)) 140 self.conn.commit()141 132 142 133 … … 150 141 fk_port_state) VALUES (?, ?, ?)", 151 142 (count, fk_host, fk_port_state)) 152 self.conn.commit()153 143 154 144 … … 163 153 fk_protocol, fk_host) VALUES (?, ?, ?, ?)", 164 154 (portid, fk_port_state, fk_protocol, fk_host)) 165 self.conn.commit()166 155 167 156 … … 177 166 (?, ?, ?, ?, ?, ?)", (osclass_accuracy, fk_osgen, 178 167 fk_osfamily, fk_osvendor, fk_ostype, fk_host)) 179 self.conn.commit()180 168 181 169 … … 190 178 fk_host) VALUES (?, ?, ?, ?)", (osmatch["name"], 191 179 osmatch["accuracy"], osmatch["line"], host)) 192 self.conn.commit()193 180 194 181 … … 200 187 201 188 self.cursor.execute("INSERT INTO osgen (gen) VALUES (?)", (osgen, )) 202 self.conn.commit() 189 203 190 204 191 def insert_osfamily_db(self, osfamily): … … 210 197 self.cursor.execute("INSERT INTO osfamily (family) VALUES (?)", 211 198 (osfamily, )) 212 self.conn.commit()213 199 214 200 … … 221 207 self.cursor.execute("INSERT INTO osvendor (vendor) VALUES (?)", 222 208 (osvendor, )) 223 self.conn.commit()224 209 225 210 … … 232 217 self.cursor.execute("INSERT INTO ostype (type) VALUES (?)", 233 218 (ostype, )) 234 self.conn.commit()235 219 236 220 … … 244 228 fk_host_state) VALUES (?, ?, ?)", (host_d["distance"], 245 229 host_d["fk_scan"], host_d["fk_host_state"])) 246 self.conn.commit()247 230 248 231 … … 255 238 self.cursor.execute("INSERT INTO _host_address (fk_host, fk_address) \ 256 239 VALUES (?, ?)", (fk_host, fk_address)) 257 self.conn.commit()258 240 259 241 … … 267 249 fk_hostname) VALUES (?, ?)", (fk_host, 268 250 fk_hostname)) 269 self.conn.commit()270 251 271 252 … … 279 260 (?, ?)", (hostname["hostname_type"], 280 261 hostname["hostname"])) 281 self.conn.commit()282 262 283 263 … … 302 282 ip_id_sequence_value, fk_host) VALUES (?, ?, ?, ?, ?, ?, ?, \ 303 283 ?, ?, ?, ?)", (data)) 304 self.conn.commit()305 284 306 285 … … 313 292 self.cursor.execute("INSERT INTO service_name (name) VALUES \ 314 293 (?)", (service_name, )) 315 self.conn.commit()316 294 317 295 … … 325 303 extrainfo, method, conf, fk_service_name) VALUES (?, ?, ?,\ 326 304 ?, ?, ?)", service_data) 327 self.conn.commit()328 305 329 306 … … 337 314 fk_vendor) VALUES (?, ?, ?)", (address_addr, 338 315 address_type, vendor)) 339 self.conn.commit()340 316 341 317 … … 348 324 self.cursor.execute("INSERT INTO vendor (name) \ 349 325 VALUES (?)", (vendor_name, )) 350 self.conn.commit()351 326 352 327 … … 359 334 self.cursor.execute("INSERT INTO host_state (state) \ 360 335 VALUES (?)", (host_state, )) 361 self.conn.commit()362 336 363 337 … … 372 346 tcpseq_dict["index"], tcpseq_dict["class"], 373 347 tcpseq_dict["difficulty"], tcpseq_dict["values"])) 374 self.conn.commit()375 348 376 349 … … 385 358 tcp_ts_values) VALUES (?, ?)", (tcptsseq_dict["class"], 386 359 tcptsseq_dict["values"])) 387 self.conn.commit()388 360 389 361 … … 397 369 ip_id_values) VALUES (?, ?)", (ipidseq_dict["class"], 398 370 ipidseq_dict["values"])) 399 self.conn.commit()400 371 401 372 … … 408 379 self.cursor.execute("INSERT INTO inventory (name) VALUES (?)", 409 380 (inventory, )) 410 self.conn.commit()411 381 412 382 … … 419 389 self.cursor.execute("INSERT INTO _inventory_scan (fk_scan, \ 420 390 fk_inventory) VALUES (?, ?)", (scan, inventory)) 421 self.conn.commit()422 391 423 392 … … 431 400 self.cursor.execute("INSERT INTO inventory_change_category (name) \ 432 401 VALUES (?)", (category, )) 433 self.conn.commit()434 402 435 403 … … 448 416 short_descr, fk_inventory, 449 417 fk_category, fk_address)) 450 self.conn.commit() 451 418 -
branch/ggpolo/umitDB/XMLStore.py
r1295 r1431 20 20 from datetime import datetime 21 21 22 from umitCore.UmitLogging import log 22 23 from umitCore.NmapParser import NmapParser 23 24 24 25 from umitDB.Connection import ConnectDB 25 26 from umitDB.Store import RawStore 26 from umitDB.Retrieve import RawRetrieve27 from umitDB.Retrieve import InventoryRetrieve 27 28 from umitDB.InventoryChanges import UpdateChanges 28 from umitDB.Utils import empty 29 from umitDB.Utils import debug 30 from umitDB.Utils import normalize 31 32 class XMLStore(ConnectDB, RawRetrieve, RawStore): 29 from umitDB.Utils import empty, debug, normalize 30 31 class XMLStore(ConnectDB, InventoryRetrieve, RawStore): 33 32 """ 34 33 Stores xml into database. 35 34 """ 36 35 37 def __init__(self, database, xml_file =None, parsed=None,36 def __init__(self, database, xml_files=None, parsed=None, 38 37 inventory=None, store_original=False): 39 38 """ 40 xml_file -nmap xml output39 xml_files - a list or a single nmap xml output 41 40 parsed - a NmapParserSAX object or None 42 41 inventory - inventory that scan will be added to, or None … … 45 44 46 45 ConnectDB.__init__(self, database) 47 RawRetrieve.__init__(self, self.conn, self.cursor)46 InventoryRetrieve.__init__(self, self.conn, self.cursor) 48 47 RawStore.__init__(self, self.conn, self.cursor) 49 48 … … 51 50 self.store_original = store_original 52 51 53 if xml_file :54 self.store_xml(xml_file , parsed, inventory)52 if xml_files: 53 self.store_xml(xml_files, parsed, inventory) 55 54 56 55 57 def store_xml(self, xml_file, parsed=None, inventory=None): 58 """ 59 Inserts xml file into database. 60 """ 61 debug("Inserting file %s" % xml_file) 62 63 self.xml_file = xml_file 64 if parsed: 65 self.parsed = parsed 66 else: 67 self.parsed = self.parse(xml_file) 68 self.scan = self.scan_from_xml() 69 self.scaninfo = self.scaninfo_from_xml() 70 self.hosts = self.hosts_from_xml() 71 56 def store_xml(self, xml_files, parsed=None, inventory=None): 57 """ 58 Inserts xml file(s) into database. 59 """ 60 log.debug(">>> Inserting file(s) into databaseng: ", xml_files) 61 72 62 if inventory: 73 debug("Inserting scan into Inventory '%s'" % inventory) 74 inv_id = self.get_inventory_id_from_db(inventory) 75 if not inv_id: # create new inventory 76 self.insert_inventory_db(inventory) 77 inv_id = self.get_id_for("inventory") 78 self.insert_inventory_scan_db(self.scan["pk"], inv_id) 79 63 self.invchanges = UpdateChanges(self) 64 65 if isinstance(xml_files, str): 66 # using singe file 67 xml_files = [xml_files, ] 68 69 for xml_file in xml_files: 70 self.xml_file = xml_file 71 if parsed: # used only for single file 72 self.parsed = parsed 73 else: 74 self.parsed = self.parse(xml_file) 75 76 self.scan = self.scan_from_xml() 77 self.scaninfo = self.scaninfo_from_xml() 78 self.hosts = self.hosts_from_xml() 79 80 if inventory: 81 log.debug(">>> Inserting scan into Inventory '%s'" % inventory) 82 inv_id = self.get_inventory_id_from_db(inventory) 83 if not inv_id: # create new inventory 84 self.insert_inventory_db(inventory) 85 inv_id = self.get_id_for("inventory") 86 self.insert_inventory_scan_db(self.scan["pk"], inv_id) 87 88 if inventory: 80 89 # update list of changes for inventory 81 debug("Updating list of changes for Inventory '%s'" % inventory) 82 self.update_inventory_changes(inv_id) 83 84 debug("%s inserted into database (hopefully)." % xml_file) 85 86 87 def update_inventory_changes(self, fk_inventory): 88 """ 89 Updates list of changes for an Inventory. 90 """ 91 UpdateChanges(self.database, fk_inventory) 90 log.debug(">>> Updating changes for Inventory '%s'" % inventory) 91 self.invchanges.do_update(inv_id) 92 93 self.conn.commit() 94 95 log.debug(xml_files, "inserted into database (hopefully).") 92 96 93 97 -
branch/ggpolo/umitDBUpdates/insert-changes-into-db.py
r1382 r1431 8 8 9 9 import sys 10 from umitDB.InventoryChanges import UpdateChanges10 from umitDB.InventoryChanges import ConnectToUpdate, UpdateChanges 11 11 12 12 def perform_update(database): … … 14 14 Update changes for each inventory. 15 15 """ 16 uc_instance = UpdateChanges(database) 17 inv_ids = uc_instance.get_inventories_ids() 16 db_conn = ConnectToUpdate(database) 17 18 uc_instance = UpdateChanges(db_conn) 19 inv_ids = db_conn.get_inventories_ids() 18 20 inv_ids = [i_id[0] for i_id in inv_ids] 19 21 … … 21 23 uc_instance.do_update(i_id) 22 24 25 db_conn.conn.commit() 23 26 24 27 if __name__ == "__main__": -
branch/ggpolo/umitInventory/About.py
r1372 r1431 31 31 from umitCore.I18N import _ 32 32 from umitCore.Paths import Path, VERSION, REVISION 33 from umitInventory.Version import NI_BUILD33 from umitInventory.Version import __version__ 34 34 35 35 pixmaps_dir = Path.pixmaps_dir … … 47 47 <span size='10000' weight='heavy'>Rev. %s</span> 48 48 <span size='10000' weight='heavy'>Network Inventory Build %s</span>""" % (VERSION, 49 REVISION, NI_BUILD)))49 REVISION, __version__))) 50 50 self.lbl_program_description = gtk.Label(_(""" 51 51 UMIT Network Inventory and UMIT Scheduler are UMIT -
branch/ggpolo/umitInventory/ChangesDiff.py
r1382 r1431 29 29 from umitGUI.DiffCompare import DiffLegendWindow 30 30 31 from umitDB.Retrieve import InventoryRetrieve32 33 31 EMPTY = _("Nothing being shown.") 34 32 NA = _("Not Available") … … 533 531 # extraports 534 532 epdata = self.invdb.get_extraports_data_for_host_from_db(host_id) 533 535 534 ep_d = { } 536 535 for ep in epdata: … … 661 660 self.show_all() 662 661 663 664 class DiffWindow(gtk.Window):665 def __init__(self, db):666 gtk.Window.__init__(self)667 668 self.invdb = InventoryRetrieve(db)669 670 self.compare_view = ChangesDiff(self.invdb)671 self.compare_view.make_diff(133, 1)672 self.add(self.compare_view)673 674 675 if __name__ == "__main__":676 w = DiffWindow("/home/polo/.umit/umitng.db")677 w.show_all()678 w.connect('delete-event', lambda *args:gtk.main_quit())679 gtk.main()680 -
branch/ggpolo/umitInventory/ChangesList.py
r1320 r1431 32 32 33 33 class ChangesList(gtk.VBox): 34 def __init__(self, daddy, display, data, data_built=False, load_now=True,35 data_range=(None, None)):34 def __init__(self, daddy, invdb, display, data, data_built=False, 35 load_now=True, data_range=(None, None)): 36 36 """ 37 37 display expects to receive a ChangesDiff instance. … … 50 50 gtk.VBox.__init__(self) 51 51 52 self.invdb = ChangesRetrieve(umitdb)52 self.invdb = invdb 53 53 self.display = display 54 54 self.daddy = daddy -
branch/ggpolo/umitInventory/DataGrabber.py
r1260 r1431 26 26 #from umitInventory.TLBase import view_kind 27 27 28 from umitDB.Connection import ConnectDB 28 29 from umitDB.InventoryChanges import ChangesRetrieve 29 30 … … 37 38 } 38 39 39 class DataGrabber(C hangesRetrieve):40 class DataGrabber(ConnectDB, ChangesRetrieve): 40 41 """ 41 42 Grab data from Inventories or a single host for an Inventory, for a time … … 44 45 45 46 def __init__(self, calendar, inventory=None, hostaddr=None): 46 ChangesRetrieve.__init__(self, umitdb) 47 ConnectDB.__init__(self, umitdb) 48 ChangesRetrieve.__init__(self, self.conn, self.cursor) 47 49 48 50 self.calendar = calendar -
branch/ggpolo/umitInventory/InventoryLoad.py
r1416 r1431 22 22 23 23 from umitCore.Paths import Path 24 from umitDB.Connection import ConnectDB 24 25 from umitDB.Retrieve import InventoryRetrieve 25 26 26 27 UMITDB = Path.umitdb_ng 27 28 28 class InventoryLoad( InventoryRetrieve):29 class InventoryLoad(ConnectDB, InventoryRetrieve): 29 30 """ 30 31 Load Inventories data to be used in Network Inventory. … … 32 33 33 34 def __init__(self): 34 InventoryRetrieve.__init__(self, UMITDB) 35 ConnectDB.__init__(self, UMITDB) 36 InventoryRetrieve.__init__(self, self.conn, self.cursor) 35 37 36 38 self.invdata = None -
branch/ggpolo/umitInventory/SearchBar.py
r1300 r1431 231 231 inventory = property(get_inventory, set_inventory) 232 232 233 234 if __name__ == "__main__":235 # sample236 from umitDB.Retrieve import InventoryRetrieve237 c = InventoryRetrieve("/home/polo/.umit/umitng.db")238 239 w = gtk.Window()240 box = gtk.HBox()241 box.add(SearchBar(c))242 box.add(SearchBar(c))243 w.add(box)244 w.show_all()245 w.connect('delete-event', lambda *args: gtk.main_quit())246 gtk.main()247 -
branch/ggpolo/umitInventory/Timeline.py
r1382 r1431 43 43 gtk.VBox.__init__(self) 44 44 45 self.connector = Connector() 45 self.connector = Connector() 46 46 self.base = TLBase(self.connector, inventory, hostaddr) 47 47 … … 79 79 # changes displaying 80 80 self.changes_display = ChangesDiff(self.base) 81 self.changes_list = ChangesList(self, self.changes_display, None, 81 self.changes_list = ChangesList(self, self.base, 82 self.changes_display, None, 82 83 load_now=False) 83 84 … … 203 204 self.pack_start(main_hbox, True, True, 3) 204 205 205 206 if __name__ == "__main__":207 # sample208 win = gtk.Window()209 win.add(TLHolder())210 win.show_all()211 win.connect('delete-event', lambda *args:gtk.main_quit())212 gtk.main()213 -
branch/ggpolo/umitInventory/Version.py
r1403 r1431 22 22 """ 23 23 24 NI_BUILD = "628" 24 __version__ = "629" # more like a build version -
branch/ggpolo/umitInventory/Viewer.py
r1421 r1431 38 38 from umitCore.Utils import open_url_as 39 39 40 from umitDB.Retrieve import InventoryRetrieve40 from umitDB.Retrieve import ConnectInventoryDB 41 41 from umitDB.Search import SearchDB 42 42 … … 202 202 203 203 self.invsearch = SearchDB(umitdb) 204 self.invdb = InventoryRetrieve(umitdb)204 self.invdb = ConnectInventoryDB(umitdb) 205 205 self.invtree = InventoryTree(self) 206 206 self.invnb = HIGNotebook() … … 404 404 """ 405 405 changesd = ChangesDiff(self.invdb) 406 changesl = ChangesList(self, changesd,406 changesl = ChangesList(self, self.invdb, changesd, 407 407 data={-1: (inventory_name, host_addr)}) 408 408 … … 723 723 <toolitem action='Sched Control' /> 724 724 <separator /> 725 <toolitem action='Report a bug' />726 <toolitem action='Show Help' />727 725 </toolbar> 728 726 """ % invmenu
