def actionButton(self, button): if button.icon == "key": options = self.password_suggestion_options chars = "" if options[0]: chars += string.ascii_lowercase if options[1]: chars += string.ascii_uppercase if options[2]: chars += string.digits if options[3]: chars += string.punctuation password = "".join(random.choices(chars, k=self.password_length)) Clipboard.copy(password) toast(f"{password} Copied") if button.icon == "clipboard": Clipboard.copy(" ") toast("Clipboard Cleaned") if button.icon == "account-plus": self.manager.setAddAccountScreen()
def copy_address_clipboard(self): """ Copies the current account address to the clipboard. """ account = self.current_account address = "0x" + account.address.hex() Clipboard.copy(address)
def on_clipboard(self, *args): '''Event handler to "Copy to Clipboard" button ''' if self.ids.tab_wg.current_tab.text == 'Traceback': Clipboard.copy(self.txt_traceback.text) else: Clipboard.copy(self.log_app.text)
def on_touch_down(self, touch): """ Add selection on touch down """ if super(SelectableLabel, self).on_touch_down(touch): return True if self.collide_point(*touch.pos): if self.selected: self.parent.clear_selection() else: # Not a fan of the following few lines, but they work. temp = MarkupLabel(text=self.text).markup text = "".join(part for part in temp if not part.startswith(("[color", "[/color]", "[ref=", "[/ref]"))) cmdinput = App.get_running_app().textinput if not cmdinput.text and " did you mean " in text: for question in ( "Didn't find something that closely matches, did you mean ", "Too many close matches, did you mean "): if text.startswith(question): name = Utils.get_text_between( text, question, "? (") cmdinput.text = f"!{App.get_running_app().last_autofillable_command} {name}" break elif not cmdinput.text and text.startswith("Missing: "): cmdinput.text = text.replace("Missing: ", "!hint_location ") Clipboard.copy( text.replace('&', '&').replace('&bl;', '[').replace('&br;', ']')) return self.parent.select_with_touch(self.index, touch)
def on_touch_down(self, touch): if touch.is_double_tap: try: Clipboard.copy(self.query_tree.selected_node.text) except AttributeError: Logger.debug("SQL Panel: Object didn't have text.") ScrollView.on_touch_down(self, touch)
def _update_pos(self, dt): ''' get and update position ''' #self.dat = get_nmea(self) e, n, d = get_nmea(self) #now = time.asctime().replace(' ','_').replace(':','_') try: self.e_txt.text = e[:10]#self.dat['e'][:10] self.n_txt.text = n[:10]#self.dat['n'][:10] except: pass #self.textinput.text += 'Position obtained: '+now+'\n' Clipboard.copy(self.n_txt.text+':'+self.e_txt.text) tmp = Clipboard.paste() self.n_txt.text = tmp.split(':')[0] self.e_txt.text = tmp.split(':')[1] #self.textinput.text += 'N: '+str(self.n_txt.text)+', E: '+str(self.e_txt.text)+', D: '+str(self.dat['depth_m'])+'\n' #self.textinput2.text += str(self.dat['depth_m'])+' m'+'\n' self.textinput2.text += d+' m'+'\n' if float(d)>10: #self.dat['depth_m']>10: self.textinput2.foreground_color = (0.6,0.5,0.0,1.0) elif d=='NaN':#self.dat['depth_m']=='NaN': self.textinput2.foreground_color = (0.25,0.5,0.25,0.25) else: self.textinput2.foreground_color = (0.0,0.0,0.0,0.0)
def copy(self,text): try: from kivy.core.clipboard import Clipboard Clipboard.copy(text) except: logger.error("Could not be copied to clipboard: "+text) pass
def data_received(self, data): if data: text = data.decode('utf-8', 'ignore') if text == "*1*": self.app.last_connection_time = datetime.now() return print(text) nickname = '' msg = '' for num, i in enumerate(text.split(':'), start=0): if num == 0: nickname = i elif num == 1: msg += i else: msg += ':' + i # 添加文字到聊天框 self.app.root.ids.chat_logs.text += ( '[b][color=2980b9]{}:[/color][/b] {}\n'.format(nickname, esc_markup(msg)) ) # 拷贝到剪贴板,奇怪 Clipboard.copy(msg)
def _update_pos(self, dt): ''' get and update position ''' e, n, lon, lat = get_nmea(self) try: self.e_txt.text = e[:10]#self.dat['e'][:10] self.n_txt.text = n[:10]#self.dat['n'][:10] except: pass Clipboard.copy(self.n_txt.text+':'+self.e_txt.text) tmp = Clipboard.paste() self.n_txt.text = tmp.split(':')[0] self.e_txt.text = tmp.split(':')[1] if MAKEMAP: self.map.simple_marker([lat, lon], marker_color='red') self.map.save(self.mapname) if SHOWMAP: # plot position and color code by time elapsed secs = time.mktime(time.localtime())-self.starttime self.fig.gca().scatter(float(e),float(n),s=30,c=secs, vmin=1, vmax=1200, cmap='Greens') self.fig.gca().set_ylim([float(n)-IMBOX_Y, float(n)+IMBOX_Y]) self.fig.gca().set_xlim([float(e)-IMBOX_X, float(e)+IMBOX_X]) self.fig.canvas.draw()
def copy_text(self, inst, text): if self.contains_link(text): self.open_url(text) else: text = text.replace('&bl;', '[').replace('&br;', ']').replace('&', '&') Clipboard.copy(text)
def f(*a): try: from kivy.core.clipboard import Clipboard Clipboard.copy("http://" + info['hash'] + ".localhost:7009") except: logging.exception("Could not copy to clipboard")
def callback_for_menu_items(self, *args): if not args[0] == the_settings()["wallet"]: change_wallet(args[0]) self.reflesh_balance() else: change_wallet(args[0]) Clipboard.copy(Wallet_Import(int(args[0]),3)) toast("The address has been copied to your clipboard.")
def _on_identifier_button_release(self, button): # TODO: Move this to event which LibraryView can dispatch if self._id_exist: if button.last_touch.button == 'left': url = 'https://archive.org/details/{}'.format(self.identifier) webbrowser.open(url) elif button.last_touch.button == 'right': Clipboard.copy(self.identifier)
def cbr_cpy(*a): print("Accept Button") self.dialog.dismiss() try: from kivy.core.clipboard import Clipboard Clipboard.copy(text) except: logging.exception("Could not copy to clipboard")
def copy_password(self): globals() try: Clipboard.copy(generatedPassword) except: print("Could not be copied to clipboard: " + generatedPassword) pass
def callback_for_menu_items(self, *args): if not args[0] == the_settings()["wallet"]: change_wallet(int(args[0])) self.reflesh_balance() Clipboard.copy(Wallet_Import(int(args[0]), 3)) SweetAlert().fire( "The address has been copied to your clipboard.", type='success', )
def copy_link(self): """copy link to the clipboard available for pasting""" try: # without try,if the user presses copy without first generating the link, the app will crash Clipboard.copy( self.link ) # we are not creating an Object instance, we dont have to instantiate that Clipboard Class # because this method is a Classmethod of Clipboard and not an Object method!!! except: self.ids.label.text = self.exception
def copy_address_clipboard(self): """Copies the current account address to the clipboard.""" # lazy loading from kivy.core.clipboard import Clipboard account = self.current_account if not account: return address = "0x" + account.address.hex() Clipboard.copy(address)
def on_clipboard_key_c(self, lit: str = ""): """ copy focused item or the currently displayed node items to the OS clipboard. :param lit: string literal to copy (def=current_item_or_node_literal()). """ if not lit: lit = self.current_item_or_node_literal() self.vpo(f"LiszApp.on_clipboard_key_c: copying {lit}") Clipboard.copy(lit)
def export_playlist(self): if not self.playlist or not self.songs: return buffer = export_playlist(self._db, self.songs, self.playlist["author"]) Clipboard.copy(buffer) InfoPopup("The playlist has been exported to your cilpboard.")
def _on_touch_down(self, instance, touch): """ Copy text on right-click """ if not self.collide_point(*touch.pos): return elif touch.button == 'right': Clipboard.copy(self.text) alert('Copied to clipboard') else: super().on_touch_down(touch)
def generate_profile_json(self): profile = self.generate_profile() Clipboard.copy( json.dumps(profile, cls=DecimalEncoder, sort_keys=True, indent=4, separators=(',', ': '))) self.msg_label.text = "profile json copied to clipboard"
def copy_color(self,*args): Clipboard.copy("(%.2f, %.2f , %.2f , %.2f)"%(self.pixel[0],self.pixel[1],self.pixel[2],self.pixel[3])) #animating and changing text of copy_btn to indicate that color has been copied self.ids.copy_btn.text="Copied" anim=Animation(size=(220,60),duration=0.25) anim+=Animation(size=(200,50),duration=0.25) anim.start(self.ids.copy_btn) Clock.schedule_once(self.copy_btn_text_change,0.5)
def action(self, button): item = [] if type(button.parent.parent.parent).__name__ == 'History': for data in self.left_check_list: if data.state == 'down': item.append(data.parent.parent) else: item.append(button.parent.parent.parent) item_data = str(item[0].text + ' ' + item[0].secondary_text) if button.icon == 'content-copy': Clipboard.copy(item_data) elif button.icon == 'history': self.main.pages.pages_list[ current_page[0]].entry.text = item_data.split()[0] self.parent.dismiss() elif button.icon == 'qrcode': image = Image(source="") imgIO = io.BytesIO() qrcode.make(item_data).save(imgIO, ext='png') imgIO.seek(0) imgData = io.BytesIO(imgIO.read()) image.texture = CoreImage(imgData, ext='png').texture image.reload() dialog = ModalView(size_hint=(None, None), size=image.texture.size) dialog.add_widget(image) dialog.open() elif button.icon in ['delete', 'delete-sweep']: dialog_yes = MDFlatButton(text="yes") dialog_no = MDRaisedButton(text="no") dialog = MDDialog(text="Delete {} item{}?".format( len(item), '' if len(item) == 1 else 's'), buttons=[dialog_no, dialog_yes]) with open('history.json', 'r') as file: data = json.load(file) for item_ in item: data.pop(item_.time) dialog_no.bind(on_release=dialog.dismiss) dialog_yes.bind(on_release=dialog.dismiss) dialog_yes.bind(on_release=lambda button: json.dump( data, open('history.json', 'w'), indent=4)) dialog_yes.bind(on_release=self.item_check) dialog.bind(on_dismiss=self.refresh) dialog.open()
def menu_callback(self, instance_menu, instance_menu_item): if instance_menu_item.text.lower() == "edit": self.edit = self.rule elif instance_menu_item.text.lower() == "delete": self.delete = self.rule elif instance_menu_item.text.lower() == "copy": Clipboard.copy(json.dumps(asdict(self.rule))) toast('Copied !!!') elif instance_menu_item.text.lower() == "favorite": self.favorite = self.rule instance_menu.dismiss()
def export_transaction_csv(self): if export_the_transactions(): Clipboard.copy(MY_TRANSACTION_EXPORT_PATH) SweetAlert().fire( f"CSV file created in {MY_TRANSACTION_EXPORT_PATH} directory, The directory has been copied to your clipboard.", type='success', ) else: SweetAlert().fire( "You have not a transaction", type='failure', )
def savepwd(self): encryped_pass = encrypt("password", self.password) u_name = self.ids.usrname.text cursor.execute(''' INSERT INTO pwd values(?,?)''', (u_name, encryped_pass)) db.commit() Clipboard.copy(self.password) popup = Popup(title='Saved !', content=Label(text='Copied to clipboard'), size_hint=(None, None), size=(400, 200)) popup.open()
def clipit(self, text, status): address = str(text.text) addy = '' msg = "Stauts: Your output has been send to the clipboard: \n\n" for index in address: try: addy += phonetic[index] + ' ' except KeyError: pass Clipboard.copy(addy) status.text = msg text.text = addy
def set_clipboard(self, text, skip_history=False, overwrite_history=False): #Sets a preset to the clipboard if text and text != self.current_clipboard: Clipboard.copy(text) if overwrite_history: if len(self.clipboard_history) == 0: self.clipboard_history.append({'text': text}) else: self.clipboard_history[0]['text'] = text self.current_clipboard = text self.refresh_history_areas() if skip_history: self.current_clipboard = text
def buttons(self): ''' Corrdinates buttons for all cells in page All cells that are meant to change a setting are redirected to 'change()' ''' print("**** came into buttons *****") if "copy" in self.topic.lower(): email = self.app.get_creds().service_account_email Clipboard.copy(email) self.app.alert("Link email copied to clipboard. \n Share with sheet to give access") elif self.topic in self.app.root.ids.settings_id.changes or "Custom Class" in self.topic: self.change()
def _update_pos(self, dt): ''' get and update position ''' e, n, lon, lat = get_nmea(self) # d = get_nmeadepth(self) try: self.e_txt.text = e[:10]#self.dat['e'][:10] self.n_txt.text = n[:10]#self.dat['n'][:10] # self.d_txt.text = d except: pass Clipboard.copy(self.n_txt.text+':'+self.e_txt.text)
def open_dl_folder(self): dl = SongDownloader() path = dl.get_song_path(self.song_id) if path: path = os.path.abspath(path) if os.getenv('WINDIR'): explorer = os.path.join(os.getenv('WINDIR'), 'explorer.exe') subprocess.run([explorer, '/select,', path]) else: Clipboard.copy(path) InfoPopup("The path has been copied to your clipboard.")
def on_release(self): emoji_code = self.emoji['emoji'] if '-' in emoji_code: sequence = emoji_code.split('-') emoji_character = chr(int(sequence[0], 16)) + chr( int(sequence[1], 16)) else: emoji_character = chr(int(emoji_code, 16)) Clipboard.copy(emoji_character) if CLOSE_ON_SELECTION: exit()
def Fetch(self): #fetch data from db u_name = self.ids.ret_usrname.text cursor.execute('''select password from pwd where username = ?''', (u_name, )) data = cursor.fetchone() print(data[0]) decrypted_pass = decrypt("password", data[0]).decode("utf-8") Clipboard.copy(decrypted_pass) popup = Popup(title='Saved !', content=Label(text='Copied to clipboard'), size_hint=(None, None), size=(400, 200)) popup.open()
def _update_pos(self, dt): ''' get and update position ''' e, n, lon, lat = get_nmea(self) try: self.e_txt.text = e[:10]#self.dat['e'][:10] self.n_txt.text = n[:10]#self.dat['n'][:10] except: pass Clipboard.copy(self.n_txt.text+':'+self.e_txt.text) tmp = Clipboard.paste() self.n_txt.text = tmp.split(':')[0] self.e_txt.text = tmp.split(':')[1]
def test_paste_text(self): """ paste_text() else: return self.pasted_str """ from kivy.core.clipboard import Clipboard _clipboard = Clipboard.copy("test") test_paste = self.encrypt.paste_text() self.assertEqual(test_paste, "test")
def test_paste_text_max(self): """ paste_text() if len(self.pasted_str) >= 1000: """ from kivy.core.clipboard import Clipboard _clipboard = Clipboard.copy("test" * 1000) test_paste = self.encrypt.paste_text() self.assertEqual(test_paste, "")
def on_start(self): text = '' if CutBuffer: text = CutBuffer.get_cutbuffer() else: cbbtn = root.ids.cutbuffer cbbtn.parent.remove_widget(cbbtn) if not text: text = Clipboard.copy() root.ids.source.text = text or '' root.ids.manip.focus = True
def cpClipboard(self): print("Copy current Kanji to clipboard") Clipboard.copy("{}".format(self.master_kanji.cur_framekanji)) # TODO fix UTF8 print(Clipboard.get_types())
def copy_output(self): Clipboard.copy(root.ids.output.text) if CutBuffer: CutBuffer.set_cutbuffer(root.ids.output.text)
def binding(btn): text_to_copy = self.hash_repr.text[:self.hash_repr.format_border] Clipboard.copy(text_to_copy)
def paste_clipboard(text): # convert to appropriate format text = unicode(text) Clipboard.copy(text)
def on_clipboard(self, *args): '''Event handler to "Copy to Clipboard" button ''' Clipboard.copy(self.txt_traceback.text)
def copy_to_clipboard(self, data): from kivy.core.clipboard import Clipboard Clipboard.copy(data)