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")
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")
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("")
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)
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()
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)
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()