Esempio n. 1
0
 def doAction(self, confirmed):
     if not confirmed or confirmed[1] == "abort":
         return
     action = confirmed[1]
     serviceUtil.setServices(self.service_list, self.destinationpath)
     total, used, free = diskUsage(self.destinationpath)
     job = serviceUtil.prepareJob()
     services = job.prepare()
     required = job.getSizeTotal()
     if required > free:
         serviceUtil.clear()
         text = []
         text = _(
             "On destination data carrier is not enough space available.")
         if action == "move":
             text += " " + _("Another %s are required to move the data."
                             ) % (realSize(required - free))
         else:
             text += " " + _("Another %s are required to copy the data."
                             ) % (realSize(required - free))
         text += "\r\n\r\n" + _("Destination carrier")
         text += "\r\n" + _("Free space:") + " " + realSize(free)
         text += "\r\n" + _("Total size:") + " " + realSize(total)
         self.session.open(MessageBox, text, MessageBox.TYPE_ERROR)
         return
     if len(services) != 0:
         serviceUtil.clear()
         text = []
         for s in services:
             print s.getName()
             text.append(s.getName())
         self.session.open(
             MessageBox,
             _("Movie(s) are already in the destination directory. Operation cancelled!"
               ) + "\r\n\r\n" + "\r\n".join(text), MessageBox.TYPE_INFO)
         return
     if action == "copy":
         serviceUtil.copy()
     elif action == "move":
         serviceUtil.move()
     if config.AdvancedMovieSelection.show_move_copy_progress.value:
         serviceUtil.setCallback(showFinished, self.session)
         self.session.openWithCallback(self.__doClose, MoveCopyProgress)
     else:
         serviceUtil.setCallback(None)
         self.__doClose()
Esempio n. 2
0
 def selectionChanged(self):
     job = self["list"].getCurrent()
     if job:
         movie_count = job.getMovieCount()
         app_info = job.getMode() and _("Move of") or _("Copy of")
         app_info += " %d " % (movie_count)
         app_info += movie_count == 1 and _("movie") or _("movies")
         app_info += " (%s)" % (realSize(job.getSizeTotal()))
         self.setTitle(app_info)
     else:
         self.setTitle(_("Move/Copy progress"))
Esempio n. 3
0
 def selectionChanged(self):
     job = self["list"].getCurrent()
     if job:
         movie_count = job.getMovieCount()
         app_info = job.getMode() and _("Move of") or _("Copy of")
         app_info += " %d " % (movie_count)
         app_info += movie_count == 1 and _("movie") or _("movies")
         app_info += " (%s)" % (realSize(job.getSizeTotal()))
         self.setTitle(app_info)
     else:
         self.setTitle(_("Move/Copy progress"))
Esempio n. 4
0
 def doAction(self, confirmed):
     if not confirmed or confirmed[1] == "abort":
         return
     action = confirmed[1]
     serviceUtil.setServices(self.service_list, self.destinationpath)
     total, used, free = diskUsage(self.destinationpath)
     job = serviceUtil.prepareJob()
     services = job.prepare()
     required = job.getSizeTotal()
     if required > free:
         serviceUtil.clear()
         text = []
         text = _("On destination data carrier is not enough space available.")
         if action == "move":
             text += " " + _("Another %s are required to move the data.") % (realSize(required - free))
         else:
             text += " " + _("Another %s are required to copy the data.") % (realSize(required - free))
         text += "\r\n\r\n" + _("Destination carrier")
         text += "\r\n" + _("Free space:") + " " + realSize(free)
         text += "\r\n" + _("Total size:") + " " + realSize(total)
         self.session.open(MessageBox, text, MessageBox.TYPE_ERROR)
         return
     if len(services) != 0:
         serviceUtil.clear()
         text = []
         for s in services:
             print s.getName()
             text.append(s.getName())
         self.session.open(MessageBox, _("Movie(s) are already in the destination directory. Operation cancelled!") + "\r\n\r\n" + "\r\n".join(text), MessageBox.TYPE_INFO)
         return
     if action == "copy":
         serviceUtil.copy()
     elif action == "move":
         serviceUtil.move()
     if config.AdvancedMovieSelection.show_move_copy_progress.value:
         moveCopyNotifier.start(self.session)
         self.session.openWithCallback(self.__doClose, MoveCopyProgress)
     else:
         self.__doClose()
 def buildMovieListEntry(self, serviceref, info, begin, length):
     res = [ None ]
     width = self.l.getItemSize().width()
     date = _("Record date:") + ' ' + self.getDate(serviceref)
     time = _("Record time:") + ' ' + self.getTime(serviceref)
     description = serviceref.getShortDescription()
     filesize = realSize(getServiceSize(serviceref.getPath()), int(config.AdvancedMovieSelection.filesize_digits.value))
     res.append(MultiContentEntryText(pos=(self.line1Pos.x(), self.line1Pos.y()), size=(width - self.line1Pos.x() - self.line1Split, self.f0h), font=0, flags=RT_HALIGN_LEFT, text=serviceref.getName()))
     res.append(MultiContentEntryText(pos=(self.line2Pos.x(), self.line2Pos.y()), size=(width - self.line2Pos.x() - self.line2Split, self.f1h), font=1, flags=RT_HALIGN_LEFT, text=description))
     res.append(MultiContentEntryText(pos=(self.line3Pos.x(), self.line3Pos.y()), size=(width - self.line3Pos.x() - self.line3Split, self.f2h), font=2, flags=RT_HALIGN_LEFT, text=os.path.dirname(serviceref.getPath())))
     res.append(MultiContentEntryText(pos=(width - self.line1Split, self.line1Pos.y()), size=(self.line1Split - self.line1Pos.x(), self.f0h), font=0, flags=RT_HALIGN_RIGHT, text=filesize))
     res.append(MultiContentEntryText(pos=(width - self.line2Split, self.line2Pos.y()), size=(self.line2Split - self.line2Pos.x(), self.f1h), font=1, flags=RT_HALIGN_RIGHT, text=time))
     res.append(MultiContentEntryText(pos=(width - self.line3Split, self.line3Pos.y()), size=(self.line3Split - self.line3Pos.x(), self.f2h), font=2, flags=RT_HALIGN_RIGHT, text=date))
     return res
Esempio n. 6
0
    def buildListEntry(self, job):
        res = [None]
        try:
            width = self.l.getItemSize().width()

            full = job.getSizeTotal()
            copied = job.getSizeCopied()
            if full == 0:
                full = 1
            if copied == 0:
                copied = 1
            elapsed_time = job.getElapsedTime()
            progress = copied * 100 / full
            b_per_sec = elapsed_time != 0 and copied / elapsed_time or 0
            mode = job.getMode() and _("Move") or _("Copy")
            name_info = _("Name:")
            if job.isCancelled():
                mode = _("Cancelled")
            if job.isFinished():
                mode = _("Finished")
                movie_name = ""
                name_info = ""
            else:
                movie_name = job.getMovieName()
            error = job.getError()
            if error:
                mode = _("Error")
                movie_name = str(error)
                name_info = _("Error:")
            #etime = time.strftime("%H:%M:%S", time.gmtime(elapsed_time))
            main_info = "%s  %d/%d (%s)  %d%%" % (mode, job.getMovieIndex(),
                                                  job.getMovieCount(),
                                                  realSize(full), progress)
            #file_info = "(%d/%d)" % (job.getFileIndex(), job.getFileCount())
            #speed_info = _("Total files") + file_info + " " + _("Average") + " " + realSize(b_per_sec, 3) + "/" + _("Seconds")

            src_p = job.getSourcePath()
            dst_p = job.getDestinationPath()
            from_info = os.path.basename(src_p) + " (%s)" % (src_p)
            to_info = os.path.basename(dst_p) + " (%s)" % (dst_p)
            remaining_bytes = full - copied
            remaining_seconds = b_per_sec != 0 and remaining_bytes / b_per_sec or -1
            remaining_elements = "%d (%s)" % (job.getFileCount() -
                                              job.getFileIndex(),
                                              realSize(remaining_bytes, 1))
            if job.isFinished():
                remaining_time = mode
            elif remaining_seconds == -1:
                remaining_time = _("Calculating...")
            elif remaining_seconds > 60 * 60:
                remaining_time = time.strftime("%H:%M:%S",
                                               time.gmtime(remaining_seconds))
            elif remaining_seconds > 120:
                remaining_time = _("Around %d minutes") % (remaining_seconds /
                                                           60)
            elif remaining_seconds > 60:
                remaining_time = _("Around %d minute") % (remaining_seconds /
                                                          60)
            else:
                remaining_time = "%d %s" % (remaining_seconds, _("Seconds"))
            speed = realSize(b_per_sec, 3) + "/" + _("Second")

            res.append(
                MultiContentEntryProgress(pos=(5, 2),
                                          size=(width - 10, 5),
                                          percent=progress,
                                          borderWidth=1))

            info_width = 180
            res.append(
                MultiContentEntryText(pos=(5, 9),
                                      size=(width, 26),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=_("Status:")))
            res.append(
                MultiContentEntryText(pos=(5, 32),
                                      size=(info_width, 22),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=name_info))
            res.append(
                MultiContentEntryText(pos=(5, 52),
                                      size=(info_width, 20),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=_("From:")))
            res.append(
                MultiContentEntryText(pos=(5, 72),
                                      size=(info_width, 20),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=_("To:")))
            if not job.isFinished():
                res.append(
                    MultiContentEntryText(pos=(5, 92),
                                          size=(info_width, 20),
                                          font=1,
                                          flags=RT_HALIGN_LEFT,
                                          text=_("Remaining time:")))
            res.append(
                MultiContentEntryText(pos=(5, 112),
                                      size=(info_width, 20),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=_("Remaining elements:")))
            res.append(
                MultiContentEntryText(pos=(5, 132),
                                      size=(info_width, 20),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=_("Speed:")))

            res.append(
                MultiContentEntryText(pos=(info_width, 9),
                                      size=(width, 26),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=main_info))
            res.append(
                MultiContentEntryText(pos=(info_width, 32),
                                      size=(width, 22),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=movie_name))
            res.append(
                MultiContentEntryText(pos=(info_width, 52),
                                      size=(width, 20),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=from_info))
            res.append(
                MultiContentEntryText(pos=(info_width, 72),
                                      size=(width, 20),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=to_info))
            if not job.isFinished():
                res.append(
                    MultiContentEntryText(pos=(info_width, 92),
                                          size=(width, 20),
                                          font=1,
                                          flags=RT_HALIGN_LEFT,
                                          text=remaining_time))
            res.append(
                MultiContentEntryText(pos=(info_width, 112),
                                      size=(width, 20),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=remaining_elements))
            res.append(
                MultiContentEntryText(pos=(info_width, 132),
                                      size=(width, 20),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=speed))

            res.append(
                MultiContentEntryText(pos=(width - 200, 9),
                                      size=(195, 26),
                                      font=0,
                                      flags=RT_HALIGN_RIGHT,
                                      text=realSize(copied)))
            #res.append(MultiContentEntryText(pos=(width - 150, 32), size=(145, 22), font=1, flags=RT_HALIGN_RIGHT, text=etime))
        except Exception as e:
            print(str(e))
        return res
Esempio n. 7
0
 def buildListEntry(self, job):
     res = [ None ]
     try:
         width = self.l.getItemSize().width()
         
         full = job.getSizeTotal()
         copied = job.getSizeCopied()
         if full == 0:
             full = 1
         if copied == 0:
             copied = 1
         elapsed_time = job.getElapsedTime()
         progress = copied * 100 / full
         b_per_sec = elapsed_time != 0 and copied / elapsed_time or 0
         mode = job.getMode() and _("Move") or _("Copy")
         name_info = _("Name:")
         if job.isCancelled():
             mode = _("Cancelled")
         if job.isFinished():
             mode = _("Finished")
             movie_name = ""
             name_info = ""
         else:
             movie_name = job.getMovieName()
         error = job.getError() 
         if error:
             mode = _("Error")
             movie_name = str(error)
             name_info = _("Error:")
         #etime = time.strftime("%H:%M:%S", time.gmtime(elapsed_time))
         main_info = "%s  %d/%d (%s)  %d%%" % (mode, job.getMovieIndex(), job.getMovieCount(), realSize(full), progress)
         #file_info = "(%d/%d)" % (job.getFileIndex(), job.getFileCount())
         #speed_info = _("Total files") + file_info + " " + _("Average") + " " + realSize(b_per_sec, 3) + "/" + _("Seconds")
 
         src_p = job.getSourcePath()
         dst_p = job.getDestinationPath()
         from_info = os.path.basename(src_p) + " (%s)" % (src_p)
         to_info = os.path.basename(dst_p) + " (%s)" % (dst_p)
         remaining_bytes = full - copied
         remaining_seconds = b_per_sec != 0 and remaining_bytes / b_per_sec or -1
         remaining_elements = "%d (%s)" % (job.getFileCount() - job.getFileIndex(), realSize(remaining_bytes, 1))
         if job.isFinished():
             remaining_time = mode
         elif remaining_seconds == -1:
             remaining_time = _("Calculating...")
         elif remaining_seconds > 60 * 60:
             remaining_time = time.strftime("%H:%M:%S", time.gmtime(remaining_seconds)) 
         elif remaining_seconds > 120:
             remaining_time = _("Around %d minutes") % (remaining_seconds / 60)
         elif remaining_seconds > 60:
             remaining_time = _("Around %d minute") % (remaining_seconds / 60)
         else:
             remaining_time = "%d %s" % (remaining_seconds, _("Seconds"))
         speed = realSize(b_per_sec, 3) + "/" + _("Second")
         
         res.append(MultiContentEntryProgress(pos=(5, 2), size=(width - 10, 5), percent=progress, borderWidth=1))
         
         info_width = 180
         res.append(MultiContentEntryText(pos=(5, 9), size=(width, 26), font=0, flags=RT_HALIGN_LEFT, text=_("Status:")))
         res.append(MultiContentEntryText(pos=(5, 32), size=(info_width, 22), font=1, flags=RT_HALIGN_LEFT, text=name_info))
         res.append(MultiContentEntryText(pos=(5, 52), size=(info_width, 20), font=1, flags=RT_HALIGN_LEFT, text=_("From:")))
         res.append(MultiContentEntryText(pos=(5, 72), size=(info_width, 20), font=1, flags=RT_HALIGN_LEFT, text=_("To:")))
         if not job.isFinished():
             res.append(MultiContentEntryText(pos=(5, 92), size=(info_width, 20), font=1, flags=RT_HALIGN_LEFT, text=_("Remaining time:")))
         res.append(MultiContentEntryText(pos=(5, 112), size=(info_width, 20), font=1, flags=RT_HALIGN_LEFT, text=_("Remaining elements:")))
         res.append(MultiContentEntryText(pos=(5, 132), size=(info_width, 20), font=1, flags=RT_HALIGN_LEFT, text=_("Speed:")))
 
         res.append(MultiContentEntryText(pos=(info_width, 9), size=(width, 26), font=0, flags=RT_HALIGN_LEFT, text=main_info))
         res.append(MultiContentEntryText(pos=(info_width, 32), size=(width, 22), font=1, flags=RT_HALIGN_LEFT, text=movie_name))
         res.append(MultiContentEntryText(pos=(info_width, 52), size=(width, 20), font=1, flags=RT_HALIGN_LEFT, text=from_info))
         res.append(MultiContentEntryText(pos=(info_width, 72), size=(width, 20), font=1, flags=RT_HALIGN_LEFT, text=to_info))
         if not job.isFinished():
             res.append(MultiContentEntryText(pos=(info_width, 92), size=(width, 20), font=1, flags=RT_HALIGN_LEFT, text=remaining_time))
         res.append(MultiContentEntryText(pos=(info_width, 112), size=(width, 20), font=1, flags=RT_HALIGN_LEFT, text=remaining_elements))
         res.append(MultiContentEntryText(pos=(info_width, 132), size=(width, 20), font=1, flags=RT_HALIGN_LEFT, text=speed))
 
         res.append(MultiContentEntryText(pos=(width - 200, 9), size=(195, 26), font=0, flags=RT_HALIGN_RIGHT, text=realSize(copied)))
         #res.append(MultiContentEntryText(pos=(width - 150, 32), size=(145, 22), font=1, flags=RT_HALIGN_RIGHT, text=etime))
     except Exception, e:
         print e