Beispiel #1
0
 def install_http(self, url):
     ''' install a widget directly from a http address '''
     dest_temp_dir = tempfile.mkdtemp()
     remote.download(url, dest_temp_dir)
     package_file = os.path.join(dest_temp_dir, os.path.basename(url))
     # FIXME a weak check on whether we're dealing with a control
     if "files/controls" in url: install_dir = Settings.get_setting('control_install_dir')
     else: install_dir = Settings.get_setting('display_install_dir')
     
     # FIXME another reliance to the naming scheme on gd.de
     widget_name = os.path.basename(url).rsplit('-')[0]
     final_destination = local.unpack(package_file, install_dir, widget_name)
     
     # self.local_path = final_destination
     self.notify_observers("INSTALLED", uri)
     self.__find_local_desklets()
     return True
Beispiel #2
0
 def install_version(self, version_number):
     ''' Install the given version of the widget in question. '''
     
     log("installing widget %s version %s" % (self.name, version_number))
     if self._install_parent_dir is None:
         raise "Widget.py: Attempt of installing a widget class. Should be done via subclasses." 
     
     ver = self.get_version(version_number)
     file_url = os.path.join(self.__remote_domain, ver['file_url'])
     #print "installing version", version_number, " from", file_url
     
     dest_temp_dir = tempfile.mkdtemp()
     remote.download(file_url, dest_temp_dir)
     package_file = os.path.join(dest_temp_dir, os.path.basename(file_url))
     final_destination = local.unpack(package_file, self._install_parent_dir, self.name)
     
     self.local_path = final_destination
     self.notify_observers("INSTALLED")
     
     return True