Ejemplo n.º 1
0
 def get(self, microbit_filename, local_filename):
     """
     Get the referenced micro:bit filename and save it to the local
     filename. Emit the name of the filename when complete or emit a
     failure signal.
     """
     try:
         microfs.get(microbit_filename, local_filename)
         self.on_get_file.emit(microbit_filename)
     except Exception as ex:
         logger.error(ex)
         self.on_get_fail.emit(microbit_filename)
Ejemplo n.º 2
0
Archivo: microbit.py Proyecto: opt9/mu
 def get(self, microbit_filename, local_filename):
     """
     Get the referenced micro:bit filename and save it to the local
     filename. Emit the name of the filename when complete or emit a
     failure signal.
     """
     try:
         microfs.get(microbit_filename, local_filename)
         self.on_get_file.emit(microbit_filename)
     except Exception as ex:
         logger.error(ex)
         self.on_get_fail.emit(microbit_filename)
Ejemplo n.º 3
0
 def dropEvent(self, event):
     source = event.source()
     self.disable(source)
     if isinstance(source, MicrobitFileList):
         microbit_filename = source.currentItem().text()
         local_filename = os.path.join(self.home, microbit_filename)
         logger.debug("Getting {} to {}".format(microbit_filename,
                                                local_filename))
         try:
             with microfs.get_serial() as serial:
                 logger.info(serial.port)
                 microfs.get(serial, microbit_filename, local_filename)
             super().dropEvent(event)
         except Exception as ex:
             logger.error(ex)
     self.enable(source)
Ejemplo n.º 4
0
 def dropEvent(self, event):
     source = event.source()
     self.disable(source)
     if isinstance(source, MicrobitFileList):
         microbit_filename = source.currentItem().text()
         local_filename = os.path.join(self.home,
                                       microbit_filename)
         logger.debug("Getting {} to {}".format(microbit_filename,
                                                local_filename))
         try:
             with microfs.get_serial() as serial:
                 logger.info(serial.port)
                 microfs.get(serial, microbit_filename, local_filename)
             super().dropEvent(event)
         except Exception as ex:
             logger.error(ex)
     self.enable(source)
Ejemplo n.º 5
0
 def dropEvent(self, event):
     source = event.source()
     self.disable(source)
     if isinstance(source, MicrobitFileList):
         if self.findItems(source.currentItem().text(), Qt.MatchExactly) \
                  and self.show_confirm_overwrite_dialog():
             microbit_filename = source.currentItem().text()
             local_filename = os.path.join(self.home, microbit_filename)
             logger.debug("Getting {} to {}".format(microbit_filename,
                                                    local_filename))
             try:
                 with microfs.get_serial() as serial:
                     logger.info(serial.port)
                     microfs.get(serial, microbit_filename, local_filename)
                 super().dropEvent(event)
             except Exception as ex:
                 logger.error(ex)
     self.enable(source)
     self.parent().ls()
Ejemplo n.º 6
0
 def dropEvent(self, event):
     source = event.source()
     self.disable(source)
     if isinstance(source, MicrobitFileList):
         if self.findItems(source.currentItem().text(), Qt.MatchExactly) \
                  and self.show_confirm_overwrite_dialog():
             microbit_filename = source.currentItem().text()
             local_filename = os.path.join(self.home,
                                           microbit_filename)
             logger.debug("Getting {} to {}".format(microbit_filename,
                                                    local_filename))
             try:
                 with microfs.get_serial() as serial:
                     logger.info(serial.port)
                     microfs.get(serial, microbit_filename, local_filename)
                 super().dropEvent(event)
             except Exception as ex:
                 logger.error(ex)
     self.enable(source)
     self.parent().ls()