Changeset 753

Show
Ignore:
Timestamp:
05/29/07 05:09:56 (6 years ago)
Author:
ggpolo
Message:

Continued adaptation for new database, adapted TimeLine? to work correctly when placed in site-packages

Location:
branch/ggpolo
Files:
12 added
11 removed
6 modified

Legend:

Unmodified
Added
Removed
  • branch/ggpolo/umitDB/connection.py

    r748 r753  
    2222""" 
    2323 
    24 from _database import sql 
    25 from _database import database 
    26 from utils import debug 
     24from umitDB._database import sql 
     25from umitDB._database import database 
     26from umitDB.utils import debug 
    2727 
    2828class ConnectDB: 
  • branch/ggpolo/umitDB/retrieve.py

    r748 r753  
    1818# USA 
    1919 
    20 from utils import empty 
    21 from utils import debug 
    22 from utils import normalize 
     20from umitDB.utils import empty 
     21from umitDB.utils import debug 
     22from umitDB.utils import normalize 
     23from umitDB.connection import ConnectDB 
    2324 
    2425""" 
     
    303304            return id[0] 
    304305 
     306 
     307class InventoryRetrieve(ConnectDB, RawRetrieve): 
     308    """ 
     309    Retrieves Inventories from Database. 
     310    """ 
     311 
     312    def __init__(self, db): 
     313        """ 
     314        Expects an umit database. 
     315        """ 
     316        ConnectDB.__init__(self, db) 
     317        RawRetrieve.__init__(self, self.conn, self.cursor) 
     318 
     319 
     320    def get_inventories_names(self): 
     321        """ 
     322        Returns all inventories names from database. 
     323        """ 
     324        debug("Getting all inventories name..") 
     325 
     326        names = self.cursor.execute("SELECT name FROM inventory").fetchall() 
     327 
     328        return names 
     329 
     330 
     331    def get_inventory_name_for_id(self, id): 
     332        """ 
     333        Return inventory name for id. 
     334        """ 
     335        debug("Getting inventory name for id %d.." % id) 
     336         
     337        name = self.cursor.execute("SELECT name FROM inventory WHERE pk = ?",  
     338                                    (id ,)).fetchone() 
     339 
     340        if name: 
     341            return name[0] 
     342 
     343 
  • branch/ggpolo/umitDB/store.py

    r748 r753  
    1818# USA 
    1919 
    20 from utils import empty 
    21 from utils import debug 
     20from umitDB.utils import empty 
     21from umitDB.utils import debug 
    2222     
    2323""" 
  • branch/ggpolo/umitDB/xmlstore.py

    r748 r753  
    2020from datetime import datetime 
    2121from umitCore.NmapParser import NmapParser 
    22 from connection import ConnectDB 
    23 from store import RawStore 
    24 from retrieve import RawRetrieve 
    25 from utils import empty 
    26 from utils import debug 
    27 from utils import normalize 
     22from umitDB.connection import ConnectDB 
     23from umitDB.store import RawStore 
     24from umitDB.retrieve import RawRetrieve 
     25from umitDB.utils import empty 
     26from umitDB.utils import debug 
     27from umitDB.utils import normalize 
    2828 
    2929""" 
  • branch/ggpolo/umitGUI/MainWindow.py

    r748 r753  
    5151 
    5252from umitDB.xmlstore import XMLStore 
     53from umitInventory.viewer import InvViewer 
    5354 
    5455root = False 
     
    340341 
    341342    def _view_inv(self, action): 
    342         dlg = HIGAlertDialog(self, message_format=_('No Inventory viewer yet!'), 
    343                              secondary_text=_("Working on this right now.")) 
    344         dlg.run() 
    345         dlg.destroy() 
     343        win = InvViewer() 
     344        win.show_all() 
     345 
    346346 
    347347    def _add_scan_inv(self, action): 
  • branch/ggpolo/umitInventory/tl/__init__.py

    r750 r753  
    1818# USA 
    1919 
    20 from umitInventory.tl import TimeLine 
    21 from umitInventory.tl import Arrow 
    22 from umitInventory.tl import Legend 
    23 from umitInventory.tl import YouAreHere 
    24  
     20from umitInventory.tl import timeline as _timeline 
     21from umitInventory.tl import arrow as _arrow 
     22from umitInventory.tl import legend as _legend 
     23from umitInventory.tl import youarehere as _youarehere 
    2524 
    2625def main(*args, **kwds): 
    27     return TimeLine.TL(*args, **kwds) 
     26    return _timeline.TL(*args, **kwds) 
    2827 
    2928def arrow(*args, **kwds): 
    30     return Arrow.TL_Arrow(*args, **kwds) 
     29    return _arrow.TL_Arrow(*args, **kwds) 
    3130 
    3231def legend(*args, **kwds): 
    33     return Legend.TL_Legend(*args, **kwds) 
     32    return _legend.TL_Legend(*args, **kwds) 
    3433 
    3534def youarehere(*args, **kwds): 
    36     return YouAreHere.TL_YouAreHere(*args, **kwds) 
     35    return _youarehere.TL_YouAreHere(*args, **kwds) 
     36