예제 #1
0
 def prompt(self):
     import mh
     mh.callAsyncThread(self.app.prompt,
                        "Render finished",
                        "The image is saved in {0}".format(self.renderPath),
                        "OK",
                        helpId="'renderFinishedPrompt'")
    def prompt(self):
        import mh

        mh.callAsyncThread(
            self.app.prompt,
            "Render finished",
            "The image is saved in {0}".format(self.renderPath),
            "OK",
            helpId="'renderFinishedPrompt'",
        )
예제 #3
0
 def progress(self, progress, status=None):
     import mh
     mh.callAsyncThread(self.app.progress, progress, status)
예제 #4
0
 def progress(self, progress, status=None):
     import mh
     mh.callAsyncThread(self.app.progress, progress, status)
예제 #5
0
 def run(self):
     
     cache = DownloadCache(self.path)
     mh.callAsyncThread(self.app.progress, 0.0, 'Downloading media list')
     success, code = cache.download(os.path.join(self.url, 'media.ini'))
     if success:
         f = open(os.path.join(self.path, 'media.ini'), 'r')
         filenames = f.readlines()
         n = float(len(filenames))
         for index, filename in enumerate(filenames):
             try:
                 filename = filename.split()[0]
                 mh.callAsyncThread(self.app.progress, index/n, 'Downloading %s' % filename)
                 url = os.path.join(self.url, filename)
                 success, code = cache.download(url)
             except:
                 pass
         f.close()
         mh.callAsyncThread(self.app.progress, 1.0)
     else:
         mh.callAsyncThread(self.app.progress, 1.0)
         mh.callAsyncThread(self.app.prompt, 'Error', 'Failed to sync media from %s, error %d.' % (self.path, code), 'OK')
         
     if self.callback:
          mh.callAsyncThread(self.callback)
예제 #6
0
    def run(self):

        cache = DownloadCache(self.path)
        mh.callAsyncThread(self.app.progress, 0.0, 'Downloading media list')
        success, code = cache.download(os.path.join(self.url, 'media.ini'))
        if success:
            f = open(os.path.join(self.path, 'media.ini'), 'r')
            filenames = f.readlines()
            n = float(len(filenames))
            for index, filename in enumerate(filenames):
                try:
                    filename = filename.split()[0]
                    mh.callAsyncThread(self.app.progress, index / n,
                                       'Downloading %s' % filename)
                    url = os.path.join(self.url, filename)
                    success, code = cache.download(url)
                except:
                    pass
            f.close()
            mh.callAsyncThread(self.app.progress, 1.0)
        else:
            mh.callAsyncThread(self.app.progress, 1.0)
            mh.callAsyncThread(
                self.app.prompt, 'Error',
                'Failed to sync media from %s, error %d.' % (self.path, code),
                'OK')

        if self.callback:
            mh.callAsyncThread(self.callback)