Пример #1
0
 def __init__(self, filename):
     super(ImportFile, self).__init__()
     self.filename = filename
     userdir = gripe.user_dir(self.user.uid())
     self.inbox = os.path.join(userdir, "inbox")
     self.queue = os.path.join(userdir, "queue")
     self.done = os.path.join(userdir, "done")
Пример #2
0
 def __init__(self, filename):
     super(ImportFile, self).__init__()
     self.filename = filename
     user_dir = gripe.user_dir(self.user.uid())
     self.inbox = os.path.join(user_dir, "inbox")
     self.queue = os.path.join(user_dir, "queue")
     self.done = os.path.join(user_dir, "done")
     self.rejected = os.path.join(user_dir, "rejected")
Пример #3
0
 def file_import(self):
     (fileNames, _) = QFileDialog.getOpenFileNames(
         self, "Open Activity File", "",
         "Activity Files (*.tcx *.fit *.csv)")
     if fileNames:
         inbox = os.path.join(
             gripe.user_dir(QCoreApplication.instance().user.uid()),
             "inbox")
         self.status_message("Delivering file(s) to inbox")
         for f in fileNames:
             shutil.copy(f, inbox)
         self.status_message("")
Пример #4
0
 def _setuser(self):
     # FIXME - gripe should read from the session, which qt.app.SweatTrails 
     # should manage
     user = QCoreApplication.instance().user
     if user != self.user:
         self.user = user
         userdir = gripe.user_dir(user.uid())
         self.inbox = os.path.join(userdir, "inbox")
         gripe.mkdir(self.inbox)
         self.queue =  os.path.join(userdir, "queue")
         gripe.mkdir(self.queue)
         done =  os.path.join(userdir, "done")
         gripe.mkdir(done)
Пример #5
0
 def process(self, antfile, data):
     with gripe.db.Tx.begin():
         path = os.path.join(gripe.root_dir(),
                             gripe.user_dir(self.user.uid()), "inbox",
                             self.get_filename(antfile))
         with open(path, "w") as fd:
             data.tofile(fd)
         f = self.get_filename(antfile)
         q = ImportedFITFile.query('"filename" =', f, parent=self.user)
         fitfile = q.get()
         if not fitfile:
             fitfile = ImportedFITFile(parent=self.user)
             fitfile.filename = f
         fitfile.status = False
         fitfile.put()
Пример #6
0
 def _setuser(self):
     # FIXME - gripe should read from the session, which qt.app.SweatTrails
     # should manage
     user = QCoreApplication.instance().user
     if user != self.user:
         self.user = user
         user_dir = gripe.user_dir(user.uid())
         self.inbox = os.path.join(user_dir, "inbox")
         gripe.mkdir(self.inbox)
         self.queue = os.path.join(user_dir, "queue")
         gripe.mkdir(self.queue)
         self.done = os.path.join(user_dir, "done")
         gripe.mkdir(self.done)
         self.rejected = os.path.join(user_dir, "rejected")
         gripe.mkdir(self.rejected)
Пример #7
0
 def process(self, antfile, data):
     with gripe.db.Tx.begin():
         path = os.path.join(gripe.root_dir(), 
                             gripe.user_dir(self.user.uid()), 
                             "inbox",
                             self.get_filename(antfile))
         with open(path, "w") as fd:
             data.tofile(fd)
         f = self.get_filename(antfile)
         q = ImportedFITFile.query('"filename" =', f, parent = self.user)
         fitfile = q.get()
         if not fitfile:
             fitfile = ImportedFITFile(parent = self.user)
             fitfile.filename = f
         fitfile.status = False
         fitfile.put()