Beispiel #1
0
    def fetchCurrentPicture(self, arg=None, menuw=None):
        url = 'http://antwrp.gsfc.nasa.gov/apod/%s'
        apodpichref = ''
        try:
            myfile = urllib.urlopen(url % 'index.html')
            apodpage = myfile.read()
            result = re.search("a href=\"(image.*)\"", apodpage)
            apodpichref = result.group(1)
        except:
            #unreachable or url error
            realurl = url % 'index.html'
            print 'APOD ERROR: could not open %s' % realurl
            dialog.show_alert(_('Unable to open URL'))
            return

        apodfile = os.path.join(self.apoddir, os.path.basename(apodpichref))

        try:
            urllib.urlretrieve(url % apodpichref, apodfile)
            imgitem = ImageItem(apodfile, self)
            imgitem.view(menuw=menuw)
        except:
            #unreachable or url error
            realurl = url % apodpichref
            print 'APOD ERROR: could not open %s' % realurl
            dialog.show_alert(_('Unable to open URL'))
            return
Beispiel #2
0
    def fetchCurrentPicture(self, arg=None, menuw=None):
        url = 'http://antwrp.gsfc.nasa.gov/apod/%s'
        apodpichref = ''
        try:
            myfile=urllib.urlopen(url % 'index.html')
            apodpage=myfile.read()
            result = re.search("a href=\"(image.*)\"", apodpage)
            apodpichref = result.group(1)
        except:
            #unreachable or url error
            realurl = url % 'index.html'
            print 'APOD ERROR: could not open %s' % realurl
            dialog.show_alert(_('Unable to open URL'))
            return

        apodfile = os.path.join(self.apoddir,os.path.basename(apodpichref))

        try:
            urllib.urlretrieve(url % apodpichref, apodfile)
            imgitem = ImageItem(apodfile, self)
            imgitem.view(menuw=menuw)
        except:
            #unreachable or url error
            realurl = url % apodpichref
            print 'APOD ERROR: could not open %s' % realurl
            dialog.show_alert(_('Unable to open URL'))
            return
Beispiel #3
0
 def showimage(self, arg=None, menuw=None):
     """Save in file and watch it"""
     logger.log( 9, 'showimage(arg=%r, menuw=%r)', arg, menuw)
     file = config.FLICKR_DIR + "/" + arg[2].replace("-","_") + ".jpg"
     if not os.path.exists(file):
         box = PopupBox(_("Downloading picture \"") + arg[0] + '"', width=600)
         box.show()
         urllib.urlretrieve(arg[1],file)
         box.destroy()
     imgitem = ImageItem(file, self, arg[0])
     imgitem.menuw=menuw
     imgitem.view(menuw=menuw)
Beispiel #4
0
 def doChoice2(self, arg=None, menuw=None):
     imgitem = ImageItem(self.importantData, self)
     imgitem.view(menuw=menuw)
Beispiel #5
0
 def doChoice2(self, arg=None, menuw=None):
     imgitem = ImageItem(self.importantData, self)
     imgitem.view(menuw=menuw)