Esempio n. 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'",
        )
 def progress(self, progress, status=None):
     import mh
     mh.callAsyncThread(self.app.progress, progress, status)
Esempio n. 4
0
 def progress(self, progress, status=None):
     import mh
     mh.callAsyncThread(self.app.progress, progress, status)
Esempio n. 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)
Esempio n. 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)