コード例 #1
0
ファイル: application.py プロジェクト: joelsefus/paella
class PaellaMainApplication(KApplication):
    def __init__(self):
        KApplication.__init__(self)
        self.set_config()
        self.conn = None
        dirs = KStandardDirs()
        self.tmpdir = str(dirs.findResourceDir('tmp', '/'))
        self.datadir = str(dirs.findResourceDir('data', '/'))
        # I probably don't need the socket dir
        self.socketdir = str(dirs.findResourceDir('socket', '/'))

    def connect_database(self, dsn=None):
        if self.conn is not None:
            raise AlreadyConnectedError, 'already connected to a database'
        self.conn = PaellaConnection(dsn=dsn)
        self.current_dsn = self.conn.get_dsn()
        
    def disconnect_database(self):
        if self.conn is not None:
            self.conn.close()
            del self.conn
            self.conn = None
        else:
            raise NotConnectedError, 'not connected to a database.'

    def set_config(self, cfg=None):
        if cfg is None:
            cfg = PaellaConfig()
        self.cfg = cfg

    def _set_default_connection(self):
        self.connect_database(cfg=PaellaConfig())
コード例 #2
0
ファイル: base.py プロジェクト: BackupTheBerlios/paella-svn
 def __init__(self, cfg=None):
     if cfg is None:
         cfg = PaellaConfig()
     dsn = cfg.get_dsn()
     dsn["dbusername"] = "******"
     PaellaConnection.__init__(self, dsn)
     print "installer connection made"
コード例 #3
0
 def __init__(self, name='Manager'):
     CommandBoxWindow.__init__(self)
     self.cfg = PaellaConfig('database')
     self.dialogs = {}.fromkeys(['dbname', 'suitemanager'])
     apps = ['profiles', 'families', 'suitemanager', 'traitmanager', 'machines',
             'traits', 'tdiff', 'sdiff', 'fdiff', 'default_environment', 'clients',
             'browser']
     self.workspace = {}.fromkeys(apps)
     self.add_menu(dbcommands, 'database', self.database_command)
     self.add_menu(self.workspace.keys(), 'edit', self.edit_command)
     self.set_size_request(150,200)
     self.conn = None
     self.dbname = None
     self.dblist = ScrollCList()
     self.vbox.add(self.dblist)
     conn = PaellaConnection(self.cfg)
     cursor = StatementCursor(conn, 'quicky')
     self.dblist.set_rows(cursor.select(table='pg_database'))
     cursor.close()
     conn.close()
     self.tbar.add_button('profiles', 'profile manager', self.run_tbar)
     self.tbar.add_button('families', 'family manager', self.run_tbar)
     self.tbar.add_button('machines', 'machine manager', self.run_tbar)
     self.tbar.add_button('traits', 'trait manager', self.run_tbar)
     self.tbar.add_button('tdiff', 'template differ', self.run_tbar)
     self.tbar.add_button('sdiff', 'script differ', self.run_tbar)
     self.tbar.add_button('fdiff', 'family differ', self.run_tbar)
コード例 #4
0
ファイル: base.py プロジェクト: BackupTheBerlios/paella-svn
 def __init__(self, cfg=None):
     if cfg is None:
         cfg = PaellaConfig()
     dsn = cfg.get_dsn()
     # enforce user to be paella
     dsn['dbusername'] = '******'
     PaellaConnection.__init__(self, dsn)
     print 'installer connection made'
コード例 #5
0
ファイル: chroot.py プロジェクト: pombredanne/paella-svn
        self.log.info('-'*30)
        self.log.info('%s processes finished' % self.__class__.__name__)
        self.log.info('-'*30)

    def save_logfile_in_target(self):
        install_log = self.target / 'root/paella/install.log'
        self.mainlog.filename.copyfile(install_log)

    # if scripts are hooked into certain processes, we
    # need to mark those processes as being completed
    # in order for other processes to be run.
    def post_process(self, procname):
        name = self.__class__.__name__
        self.log.info('%s(%s) post_process' % (name, procname))
        if procname == 'bootstrap':
            self.log.info('%s marking %s finished' % (name, procname))
            self._bootstrapped = True
        elif procname == 'install':
            self.log.info('%s marking %s finished' % (name, procname))
            self._install_finished = True
            
        
        
        
        
if __name__ == '__main__':
    from paella.db import PaellaConnection
    conn = PaellaConnection()
    ci = ChrootInstaller(conn)
    
コード例 #6
0
ファイル: application.py プロジェクト: joelsefus/paella
 def connect_database(self, dsn=None):
     if self.conn is not None:
         raise AlreadyConnectedError, 'already connected to a database'
     self.conn = PaellaConnection(dsn=dsn)
     self.current_dsn = self.conn.get_dsn()
コード例 #7
0
ファイル: profile.py プロジェクト: pombredanne/paella-svn
    def insertNewProfile(self):
        dialog = self._dialog
        data = dialog.getRecordData()
        if data['profile'] not in self.profile.get_profile_list():
            #self.profile.insert(data=data)
            self.profile.copy_profile('skeleton', data['profile'])
        else:
            KMessageBox.information(
                self, 'profile %s already exists.' % data['profile'])
        #KMessageBox.information(self, 'Make new profile %s' % data['profile'])
        self.refreshListView()

    def selectionChanged(self):
        current = self.listView.currentItem()
        if hasattr(current, 'profile'):
            self.view.set_profile(current.profile)
        if hasattr(current, 'trait'):
            print 'trait is', current.trait
            self.view.set_trait(current.trait)
        if hasattr(current, 'suite'):
            print 'suite is', current.suite
            if hasattr(current, 'widget'):
                print 'widget is', current.widget


if __name__ == '__main__':
    cfg = PaellaConfig()
    conn = PaellaConnection(cfg)
    t = Trait(conn, suite='kudzu')
コード例 #8
0
 def __init__(self):
     KApplication.__init__(self)
     self.conn = PaellaConnection()
     self.umlcfg = UmlConfig()
     self.update_config()