當前位置: 首頁>>代碼示例>>Python>>正文


Python KApplication.__init__方法代碼示例

本文整理匯總了Python中kdecore.KApplication.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python KApplication.__init__方法的具體用法?Python KApplication.__init__怎麽用?Python KApplication.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在kdecore.KApplication的用法示例。


在下文中一共展示了KApplication.__init__方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from kdecore import KApplication [as 別名]
# 或者: from kdecore.KApplication import __init__ [as 別名]
 def __init__(self, *args):
     KApplication.__init__(self)
     cfg = BaseConfig()
     self.cfg = cfg
     dirs = KStandardDirs()
     self.tmpdir = str(dirs.findResourceDir('tmp', '/'))
     self.datadir = str(dirs.findResourceDir('data', '/'))
     self.socketdir = str(dirs.findResourceDir('socket', '/'))
     dsn = {}
     self.cfg.setGroup('database')
     dsn['user'] = self.cfg.readEntry('dbuser')
     dsn['dbname'] = self.cfg.readEntry('dbname')
     dsn['passwd'] = self.cfg.readEntry('dbpass')
     self.cfg.setGroup('pgpool')
     self.pgpool = None
     usepgpool = self.cfg.readEntry('usepgpool')
     if usepgpool != 'false':
         print 'using pgpool'
         self.pgpool = PgPool(self.cfg, self.tmpdir, self.datadir)
         if not os.path.isfile(self.pgpool.pidfile):
             self.pgpool.run()
         else:
             self.pgpool = None
         dsn['host'] = 'localhost'
         dsn['port'] = self.cfg.readEntry('port')
     else:
         self.cfg.setGroup('database')
         dsn['host'] = self.cfg.readEntry('dbhost')
         dsn['port'] = self.cfg.readEntry('dbport')
     self.db = BaseDatabase(dsn, 'Konsultant', self)
     self.db.app = self
     self.connect(self, SIGNAL('aboutToQuit()'), self.quit)
開發者ID:BackupTheBerlios,項目名稱:konsultant-svn,代碼行數:34,代碼來源:main.py

示例2: __init__

# 需要導入模塊: from kdecore import KApplication [as 別名]
# 或者: from kdecore.KApplication import __init__ [as 別名]
    def __init__(self):
        KApplication.__init__(self)
        # in case something needs done before quitting
        self.connect(self, SIGNAL('aboutToQuit()'), self.quit)
        self.dcop = ToolBoxDCOPInterface()
        self._setup_standard_directories()
        #self._generate_data_directories()
        dbfile = os.path.join(self.datadir, 'main.db')
        #self.conn = Connection(dbname=dbfile, autocommit=True,
        #                       encoding='ascii')
        #self.guests = Guests(self.conn)
        #self.db = EntityManager(self.conn)
        from sqlalchemy import create_engine
        from sqlalchemy.orm import sessionmaker
        self.engine = create_engine('sqlite:///%s' % dbfile)
        if not self.engine.table_names():
            from newschema import metadata
            metadata.create_all(self.engine)
        self.DbSession = sessionmaker(bind=self.engine,
                                      autoflush=True, transactional=False)
        self.session = self.DbSession()
        self.db = EntityManager(self.session)
        
        self.urlhandler = MainUrlHandler(self)
        self.filehandler = BaseFileHandler(self)
        
        # setup the timer to handle background jobs
        self.timer = QTimer()
        # every five seconds
        self.timer.changeInterval(1000)
        self.connect(self.timer, SIGNAL('timeout()'), self._timer_done)

        self.main_window = None
開發者ID:BackupTheBerlios,項目名稱:useless-svn,代碼行數:35,代碼來源:application.py

示例3: __init__

# 需要導入模塊: from kdecore import KApplication [as 別名]
# 或者: from kdecore.KApplication import __init__ [as 別名]
 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', '/'))
開發者ID:joelsefus,項目名稱:paella,代碼行數:11,代碼來源:application.py

示例4: __init__

# 需要導入模塊: from kdecore import KApplication [as 別名]
# 或者: from kdecore.KApplication import __init__ [as 別名]
 def __init__(self):
     KApplication.__init__(self)
     # in case something needs done before quitting
     self.connect(self, SIGNAL('aboutToQuit()'), self.quit)
     self._setup_standard_directories()
     #self._generate_data_directories()
     dbfile = os.path.join(self.datadir, 'guests.db')
     self.conn = Connection(dbname=dbfile, autocommit=True,
                            encoding='ascii')
     self.guests = Guests(self.conn)
開發者ID:BackupTheBerlios,項目名稱:useless-svn,代碼行數:12,代碼來源:utapp.py

示例5: __init__

# 需要導入模塊: from kdecore import KApplication [as 別名]
# 或者: from kdecore.KApplication import __init__ [as 別名]
 def __init__(self, *args):
     KApplication.__init__(self)
     self.cfg = PaellaConfig()
     self.conn = PaellaConnection(self.cfg)
     self.db = BaseDatabase(self.conn, 'paelladb', None)
     dirs = KStandardDirs()
     self.tmpdir = str(dirs.findResourceDir('tmp', '/'))
     self.datadir = str(dirs.findResourceDir('data', '/'))
     self.socketdir = str(dirs.findResourceDir('socket', '/'))
     dsn = {}
開發者ID:BackupTheBerlios,項目名稱:paella-svn,代碼行數:12,代碼來源:main.py

示例6: __init__

# 需要導入模塊: from kdecore import KApplication [as 別名]
# 或者: from kdecore.KApplication import __init__ [as 別名]
 def __init__(self):
     KApplication.__init__(self)
     # in case something needs done before quitting
     self.connect(self, SIGNAL('aboutToQuit()'), self.quit)
     # place dcop object here
     self.dcop = DosboxHandler()
     self._setup_standard_directories()
     self._generate_data_directories()
     self.mainconfigfilename = os.path.join(self.datadir, 'dosbox-pykde.conf')
     if os.path.isfile(self.mainconfigfilename):
         self.generate_default_config()
         self.generate_main_objects()
開發者ID:umeboshi2,項目名稱:lilali,代碼行數:14,代碼來源:application.py

示例7: __init__

# 需要導入模塊: from kdecore import KApplication [as 別名]
# 或者: from kdecore.KApplication import __init__ [as 別名]
 def __init__(self):
     KApplication.__init__(self)
     self.conn = PaellaConnection()
     self.umlcfg = UmlConfig()
     self.update_config()
開發者ID:umeboshi2,項目名稱:paella,代碼行數:7,代碼來源:main.py


注:本文中的kdecore.KApplication.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。