コード例 #1
0
ファイル: Assembly.py プロジェクト: RaumZeit/gdesklets-core
 def __find_remote_desklets(self):
     self.notify_observers("FETCH", "Fetching remote desklets")
     self.remote_desklets = {}
     for (base_url, d_list, d_path, c_list, c_path) in Settings.get_setting('repositories'):
         rds = remote.get_desklets(base_url, d_list, 
                                   Settings.get_setting('cache_dir'))
         self.remote_desklets.update(rds)
         
         for d_key in rds:
             d_data = rds[d_key]
             d = Desklet(d_data['name'], d_data['description'], d_data['category'], d_data['authors'])
             d.remote_domain = base_url
             d.set_available_remotely(True)
             d.preview = d_data['preview']
             d.add_observer(self.update)
             for version_number in d_data['versions']:
                 version_object = d_data['versions'][version_number]
                 # make dependencies point to control objects
                 for dep in d_data['versions'][version_number]['dependencies']:
                     dep_object = version_object['dependencies'][dep]
                     control_object = self.get_control( dep_object['name'] )
                     d_data['versions'][version_number]['dependencies'][dep]['object'] = control_object
                     # logging.info( "added to %s dependency %s" % (d.name, control_object.name) )
                 d.add_version(version_number, d_data['versions'][version_number])
                 
             #for ver in d_data['versions']:
              #   d.add_version(ver)
             self.add_desklet(d)
コード例 #2
0
ファイル: Assembly.py プロジェクト: RaumZeit/gdesklets-core
    def __find_local_desklets(self):
        self.notify_observers("FETCH", "Fetching local desklets")
        self.local_desklets = {}
        for disp_dir in Settings.get_setting('display_dirs'):
            desklets_in_this_dir = local.get_desklets(disp_dir)
            self.local_desklets.update( desklets_in_this_dir )

            for d_key in desklets_in_this_dir:
                d_data = self.local_desklets[d_key]
                d = Desklet(d_data['name'], d_data['description'], d_data['category'], [d_data['author'],])
                d.preview = d_data['preview']
                d.local_path = os.path.join(disp_dir, d_data['directory'])
                
                # there is no version information for installed desklets unfortunately
                # so build one version based on what we know about the installed desklet
                if d_data['version'] is '':
                    d_data['version'] = 'Unknown'
                
                version = {'changes': 'Unknown', 'number': d_data['version'], 'dependencies':{} }
                d.add_version(d_data['version'], version)
                d.add_displays( d_data['displays'] )
                self.add_desklet(d)