Пример #1
0
 def init_wait(self, fs, path):
     fullpath = self.fs.selected_get()
     if fullpath == HOME or fullpath == "%s/" % HOME:
         self.fs.selected_set(HOME)
         self.fs.path_set(HOME)
         return
     elif path:
         deb = path
         mimetype = mimetypes.guess_type(deb, strict=1)[0]
         if mimetype == "application/x-debian-package":
             self.et = ecore.Timer(0.03, self.init_check, path)
             self.n = n = elm.Notify(self.win)
             lb = elm.Label(self.win)
             lb.text = "<b>Loading Package Information...</b>"
             lb.size_hint_align = 0.0, 0.5
             lb.show()
             n.orient = 1
             n.allow_events_set(False)
             n.content = lb
             n.show()
             return
         else:
             logging.info("Invalid file!")
             self.fs.selected_set(HOME)
             self.fs.path_set(HOME)
             checks.file_error_popup(self.win)
             return
     else:
         self.fs.selected_set(fullpath)
         self.fs.path_set(fullpath)
         return
Пример #2
0
 def cli_add(self, path):
     logging.info("Loading %s..." % path)
     path = self.fs.selected_get()
     deb = path
     mimetype = mimetypes.guess_type(deb, strict=1)[0]
     logging.info("Starting initial check...")
     if mimetype == "application/x-debian-package":
         deb = debianfile.DebPackage(path, cache=None)
         if deb.check() == False:
             logging.info("Initial check failed.")
             self.fs.selected_set(HOME)
             self.fs.path_set(HOME)
             self.n.delete()
             checks.not_installable_popup(self.win)
             return
         else:
             logging.info("Initial check passed.")
             chk = checks.Checks(path, self.win, end_callback=None)
             chk.check_file(self.fs, self.win)
             self.n.delete()
             return
     elif path == HOME or path == "%s/" % HOME:
         self.fs.selected_set(HOME)
         self.fs.path_set(HOME)
         self.n.delete()
         return
     else:
         logging.info("Invalid file!")
         self.fs.selected_set(HOME)
         self.fs.path_set(HOME)
         checks.file_error_popup(self.win)
         self.n.delete()
         return
     self.et.delete()