コード例 #1
0
    def __init__(self, parent, **kwargs):
        """
        The constructor loads up the database and creates and initialises the
        tables if the database doesn't exist.

        :param parent:
        :param kwargs:
            ``path``
                The path to the bible database file.

            ``name``
                The name of the database. This is also used as the file name for SQLite databases.
        """
        log.info('BibleDB loaded')
        self.bible_plugin = parent
        self.session = None
        if 'path' not in kwargs:
            raise KeyError('Missing keyword argument "path".')
        if 'name' not in kwargs and 'file' not in kwargs:
            raise KeyError('Missing keyword argument "name" or "file".')
        self.stop_import_flag = False
        if 'name' in kwargs:
            self.name = kwargs['name']
            if not isinstance(self.name, str):
                self.name = str(self.name, 'utf-8')
            self.file = clean_filename(self.name) + '.sqlite'
        if 'file' in kwargs:
            self.file = kwargs['file']
        Manager.__init__(self, 'bibles', init_schema, self.file, upgrade)
        if self.session and 'file' in kwargs:
                self.get_name()
        if 'path' in kwargs:
            self.path = kwargs['path']
        self.wizard = None
        Registry().register_function('openlp_stop_wizard', self.stop_import)
コード例 #2
0
 def _setup(self, parent, **kwargs):
     """
     Run some initial setup. This method is separate from __init__ in order to mock it out in tests.
     """
     self.bible_plugin = parent
     self.session = None
     if 'path' not in kwargs:
         raise KeyError('Missing keyword argument "path".')
     self.path = kwargs['path']
     if 'name' not in kwargs and 'file' not in kwargs:
         raise KeyError('Missing keyword argument "name" or "file".')
     if 'name' in kwargs:
         self.name = kwargs['name']
         if not isinstance(self.name, str):
             self.name = str(self.name, 'utf-8')
         self.file_path = Path(clean_filename(self.name) + '.sqlite')
     if 'file' in kwargs:
         self.file_path = kwargs['file']
     Manager.__init__(self, 'bibles', init_schema, self.file_path, upgrade)
     if self.session and 'file' in kwargs:
         self.get_name()
     self._is_web_bible = None
コード例 #3
0
ファイル: db.py プロジェクト: imkernel/openlp
 def _setup(self, parent, **kwargs):
     """
     Run some initial setup. This method is separate from __init__ in order to mock it out in tests.
     """
     self.bible_plugin = parent
     self.session = None
     if 'path' not in kwargs:
         raise KeyError('Missing keyword argument "path".')
     if 'name' not in kwargs and 'file' not in kwargs:
         raise KeyError('Missing keyword argument "name" or "file".')
     if 'name' in kwargs:
         self.name = kwargs['name']
         if not isinstance(self.name, str):
             self.name = str(self.name, 'utf-8')
         self.file = clean_filename(self.name) + '.sqlite'
     if 'file' in kwargs:
         self.file = kwargs['file']
     Manager.__init__(self, 'bibles', init_schema, self.file, upgrade)
     if self.session and 'file' in kwargs:
             self.get_name()
     if 'path' in kwargs:
         self.path = kwargs['path']
コード例 #4
0
ファイル: db.py プロジェクト: marmyshev/transitions
    def __init__(self, parent, **kwargs):
        """
        The constructor loads up the database and creates and initialises the
        tables if the database doesn't exist.

        **Required keyword arguments:**

        ``path``
            The path to the bible database file.

        ``name``
            The name of the database. This is also used as the file name for
            SQLite databases.
        """
        log.info(u'BibleDB loaded')
        QtCore.QObject.__init__(self)
        self.bible_plugin = parent
        if u'path' not in kwargs:
            raise KeyError(u'Missing keyword argument "path".')
        if u'name' not in kwargs and u'file' not in kwargs:
            raise KeyError(u'Missing keyword argument "name" or "file".')
        self.stop_import_flag = False
        if u'name' in kwargs:
            self.name = kwargs[u'name']
            if not isinstance(self.name, unicode):
                self.name = unicode(self.name, u'utf-8')
            self.file = clean_filename(self.name) + u'.sqlite'
        if u'file' in kwargs:
            self.file = kwargs[u'file']
        Manager.__init__(self, u'bibles', init_schema, self.file, upgrade)
        if u'file' in kwargs:
            self.get_name()
        if u'path' in kwargs:
            self.path = kwargs[u'path']
        self.wizard = None
        QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
コード例 #5
0
ファイル: db.py プロジェクト: crossroadchurch/paul
    def __init__(self, parent, **kwargs):
        """
        The constructor loads up the database and creates and initialises the
        tables if the database doesn't exist.

        :param parent:
        :param kwargs:
            ``path``
                The path to the bible database file.

            ``name``
                The name of the database. This is also used as the file name for SQLite databases.
        """
        log.info('BibleDB loaded')
        QtCore.QObject.__init__(self)
        self.bible_plugin = parent
        self.session = None
        if 'path' not in kwargs:
            raise KeyError('Missing keyword argument "path".')
        if 'name' not in kwargs and 'file' not in kwargs:
            raise KeyError('Missing keyword argument "name" or "file".')
        self.stop_import_flag = False
        if 'name' in kwargs:
            self.name = kwargs['name']
            if not isinstance(self.name, str):
                self.name = str(self.name, 'utf-8')
            self.file = clean_filename(self.name) + '.sqlite'
        if 'file' in kwargs:
            self.file = kwargs['file']
        Manager.__init__(self, 'bibles', init_schema, self.file, upgrade)
        if self.session and 'file' in kwargs:
                self.get_name()
        if 'path' in kwargs:
            self.path = kwargs['path']
        self.wizard = None
        Registry().register_function('openlp_stop_wizard', self.stop_import)