Пример #1
0
 def generate_qr_image(self, *args):
     data = str(self.qr_data.text)
     qr = qrcode.QRCode(version=1, box_size=10, border=4)
     qr.add_data(data)
     qr.make()
     img = qr.make_image(fill_color="black", back_color="white")
     timestr = time.strftime("%Y%m%d_%H%M%S")
     if platform == "android":
         img_name = str(
             Path.joinpath(Path(storagepath.get_pictures_dir()),
                           'qrgenread', f'QR_{timestr}.png'))
         try:
             os.mkdir(
                 Path.joinpath(Path(storagepath.get_pictures_dir()),
                               'qrgenread'))
         except Exception:
             pass
         # if Path.exists(img_name):
         #     img_name = img_name.split('.')[-1]
     else:
         img_name = str(
             Path.joinpath(Path('qrgenread'), f'QR_{timestr}.png'))
         try:
             os.mkdir(Path('qrgenread'))
         except Exception:
             pass
     print(img_name)
     self.display_qr_image(img, img_name)
     return img, img_name
Пример #2
0
 def get_path(self):
     if platform == "android":
         self.path = str(
             Path.joinpath(Path(storagepath.get_pictures_dir()),
                           'qrgenread'))
     else:
         # self.path = Path('qrgenread')
         self.path = str(Path(''))
     return self.path
Пример #3
0
    def get_qrcode(self):
        #generate yours qrcode
        global store

        user_qrcode = self.root.ids.qrcode
        '''take ids

        '''
        my_text = self.root.ids.inp
        img = qrcode.make(my_text.text)  #take url or text
        self.random_choise()
        png = '.png'
        path_save_image = storagepath.get_pictures_dir()
        slash = "\\"
        #print(slash)
        path = path_save_image + slash
        forsave = path + str(choise) + png

        img.save(forsave)
        show_qr = forsave
        user_qrcode.source = show_qr
Пример #4
0
 def file_manager_open(self):
     # self.file_manager.show('/')  # output manager to the screen
     self.file_manager.show(str(storagepath.get_pictures_dir()))
     self.manager_open = True
Пример #5
0
 def get_dcim_path(self):
     '''Gets gallery directory path'''
     if platform == 'android':
         return storagepath.get_pictures_dir()
     else:
         return self.APP_ROOT
Пример #6
0
 def btn(self):
     print(str(storagepath.get_pictures_dir()))
     self.ids.fotos_label.text = str(storagepath.get_pictures_dir())