Esempio n. 1
0
    def load(self):
        ''' Load shows, setup the basics '''
        
        label = QLabel()
        self.ui.statusbar.addWidget(label)
        
        try:
            label.setText('Loading settings')
            self.settings = settings()
            
            if self.settings.get(settings.categories.application, settings.keys.firstrun, bool):
                self.ui.tabs.setCurrentIndex(4)
                self.settings.set(settings.categories.application, settings.keys.firstrun, False)
            
            lastupdated = self.settings.get(settings.categories.application, settings.keys.lastupdated, datetime)
            self.setlastupdatedstatus(lastupdated)
            
            self.ui.settingsautoswitchshowtab.setChecked(self.settings.get(settings.categories.application, settings.keys.autoswitchshowtab, bool))
            self.ui.settingsautoswitchseasontab.setChecked(self.settings.get(settings.categories.application, settings.keys.autoswitchseasontab, bool))

            label.setText('Loading storage')
            self.storage = storage(self.settings.path())
            
            label.setText('Loading backend')
            self.backend = thetvdbbackend(self.settings)

            label.setText('Displaying shows')
            self.displayshows()
            
            self.displayshowstatuses()
        except RuntimeError as (errnum, errstr):
            print 'An error has occurred (%d: %s)' % (errnum, errstr)
Esempio n. 2
0
    def _init_hashtables(self):
        """ Initialize the hash tables such that each record will be in the
        form of "[storage1, storage2, ...]" """

        self.hash_tables = [
            storage(self.storage_config, i) for i in range(self.num_hashtables)
        ]
Esempio n. 3
0
 def __init__(self, settings):
     '''
     @type settings: L{src.settings.settings}
     '''
     self.__settings = settings
     
     # Set up storage based on the backend instance
     self._storage = storage(os.path.join(self.__settings.path(), self.__class__.__name__))
Esempio n. 4
0
 def test_saveload(self):
     obj = storage(self.temppath)
     obj.savedata('test', '123')
     self.assertEqual(obj.getdata('test'), '123', 'Data not loaded correctly')
Esempio n. 5
0
 def test_exists(self):
     obj = storage(self.temppath)
     obj.savedata('testex', '123')
     self.assertTrue(obj.exists('testex'), 'Object should exist')
     self.assertFalse(obj.exists('testnoex'), 'Object shouldn\'t exist')