def start(self): self.queue = Queue() reconnect(self.worker.finish2) self.worker = _CopyTask(self) reconnect(self.worker.finish2, self.watch) self.worker.start() self.running = True
def __init__(self): super(Copier, self).__init__() self.queue = Queue() self.errors = [] self.running = True self.worker = _CopyTask(self) reconnect(self.worker.finish2, self.watch) self.worker.start()
def loop(): p0.freq(1) p0.duty(255) while True: p2.on() temp, humid = take_measurement() now_tup = utime.localtime() if not isconnected(): reconnect() send_measurements(now_tup, temp, humid) if now_tup[4] == 0: ntptime.settime() to_sleep = 60 - utime.localtime()[5] p2.off() utime.sleep(to_sleep)
def setup(): p0.freq(4) p0.duty(255) reconnect() ntptime.host = host_name ntptime.settime()
def connectar(self): try: port = int(self.port.text()) except: self.loggin.emit('Puerto incorrect', ERROR) return ip = self.ip.text() if len(ip.split('.')) != 4: self.loggin.emit('ip incorrect', ERROR) return try: if self.ftpm: self.ftpm.close() reconnect(self.ftpm.copier.worker.names) reconnect(self.ftpm.copier.worker.progress) reconnect(self.ftpm.copier.worker.finish) reconnect(self.ftpm.copier.finish) self.ftpm = FTPManager(ip, self.user.text(), self.passw.text(), port, self.loggin) reconnect(self.ftpm.copier.worker.names, self.change_names) reconnect(self.ftpm.copier.worker.progress, self.update) reconnect(self.ftpm.copier.worker.finish, self.copy_finish2) reconnect(self.ftpm.copier.finish, self.copy_finish) self.pathbarftp.setText('/') except Exception as e: self.loggin.emit(str(e), ERROR) return self.li.clear() for i in self.ftpm.list_dir('/'): item = QListWidgetItem( qta.icon('fa5s.folder-open', color='orange'), i, self.li) self.li.addItem(item)
def set_path2(self): dirr = self.get_path() if dirr is None or dirr == '': return self.pathbar2.setText(dirr) if self.ftpm: self.ftpm.close() reconnect(self.ftpm.copier.worker.names) reconnect(self.ftpm.copier.worker.progress) reconnect(self.ftpm.copier.worker.finish) reconnect(self.ftpm.copier.finish) try: self.ftpm = FileManager(dirr, self.loggin) reconnect(self.ftpm.copier.worker.names, self.change_names) reconnect(self.ftpm.copier.worker.progress, self.update) reconnect(self.ftpm.copier.worker.finish, self.copy_finish2) reconnect(self.ftpm.copier.finish, self.copy_finish) self.pathbarftp.setText('/') except Exception as e: self.loggin.emit(str(e), ERROR) return self.li.clear() for i in self.ftpm.list_dir('/'): item = QListWidgetItem( qta.icon('fa5s.folder-open', color='orange'), i, self.li) self.li.addItem(item)