Example #1
1
 def selectaddress(self):
     """copy address to clipboard when user clicks"""
     print('User clicked on ', self.rawaddress)
     Clipboard.put(self.rawaddress)
 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)
Example #3
0
def copy(data):
    if module == "mac":
        clipboard_macosx.copy(data)
    else:
        assert module == "kivy"
        Clipboard.put(data, 'UTF8_STRING')
        Clipboard.put(data, 'text/plain')
Example #4
0
    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)
Example #5
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
Example #6
0
    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 paste_clipboard(text):
    #convert to generic
    text = text.encode('ascii')

    clipboard_types = Clipboard.get_types()
    for cb_type in clipboard_types:
        if str(cb_type).lower().strip().startswith('text'):
            Clipboard.put(text, cb_type)
            return
                
    raise Exception('Could not find plain text clipboard in ' + str(clipboard_types))
Example #8
0
    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 build(self):
     root= GridLayout()
     layout = FloatLayout(orientation='horizontal', size=(450,300), size_hint=(None, None))
     #call function when text changes inside TextInput
     textinput.bind(text=on_text)
     print ('value is ', textinput.text)
     print Clipboard.put(textinput.text,'UTF8_STRING')
     print Clipboard.get('UTF8_STRING')
     #Use copied clipboard value as text for Button
     button.text= Clipboard.get('UTF8_STRING')
     layout.add_widget(button)
     layout.add_widget(textinput)
     root.add_widget(layout)
     return root
Example #10
0
	def paste_text(self):
		self.pasted_str = Clipboard.paste()
		if len(self.pasted_str) >= 1000:
			MaxClipboardPopup().open()
			return ""
		else:
			return self.pasted_str
Example #11
0
    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]
Example #12
0
    def TakePicture(self, fig, mode):#*args):
        '''takes a picture and saves it to the folder according to 'mode'
        '''
        self.export_to_png = export_to_png

        tmp = Clipboard.paste()
        self.n_txt.text = tmp.split(':')[0]
        self.e_txt.text = tmp.split(':')[1]

        now = time.asctime().replace(' ','_').replace(':','_')

        if mode==1:
            filename = 'st'+self.txt_inpt.text+'_sand_'+now+'_'+self.e_txt.text+'_'+self.n_txt.text+'.png'
        elif mode==2:
            filename = 'st'+self.txt_inpt.text+'_gravel_'+now+'_'+self.e_txt.text+'_'+self.n_txt.text+'.png'
        elif mode==3:
            filename = 'st'+self.txt_inpt.text+'_rock_'+now+'_'+self.e_txt.text+'_'+self.n_txt.text+'.png'
        elif mode==4:
            filename = 'st'+self.txt_inpt.text+'_sandrock_'+now+'_'+self.e_txt.text+'_'+self.n_txt.text+'.png'
        elif mode==5:
            filename = 'st'+self.txt_inpt.text+'_sandgravel_'+now+'_'+self.e_txt.text+'_'+self.n_txt.text+'.png'
        elif mode==6:
            filename = 'st'+self.txt_inpt.text+'_gravelsand_'+now+'_'+self.e_txt.text+'_'+self.n_txt.text+'.png'

        self.export_to_png(self.ids.camera, filename=filename)

        if mode==1:
            subprocess.Popen("python resize_n_move.py -i "+filename+" -o eyeballimages", shell=True)
            self.textinput.text += 'Sand image collected:\n'
        elif mode==2:
            subprocess.Popen("python resize_n_move.py -i "+filename+" -o gravelimages", shell=True)
            self.textinput.text += 'Gravel image collected:\n'
        elif mode==3:
            subprocess.Popen("python resize_n_move.py -i "+filename+" -o rockimages", shell=True)
            self.textinput.text += 'Rock image collected:\n'
        elif mode==4:
            subprocess.Popen("python resize_n_move.py -i "+filename+" -o sandrockimages", shell=True)
            self.textinput.text += 'Sand/Rock image collected:\n'
        elif mode==5:
            subprocess.Popen("python resize_n_move.py -i "+filename+" -o sandgravelimages", shell=True)
            self.textinput.text += 'Sand/Gravel image collected:\n'
        elif mode==6:
            subprocess.Popen("python resize_n_move.py -i "+filename+" -o gravelsandimages", shell=True)
            self.textinput.text += 'Gravel/Sand image collected:\n'

        if SHOWMAP:
            if mode==1:
                fig.gca().plot(float(self.e_txt.text),float(self.n_txt.text),'ys')
            elif mode==2:
                fig.gca().plot(float(self.e_txt.text),float(self.n_txt.text),'s',color=(.5,.5,.5))
            elif mode==3:
                fig.gca().plot(float(self.e_txt.text),float(self.n_txt.text),'rs')
            elif mode==4:
                fig.gca().plot(float(self.e_txt.text),float(self.n_txt.text),'s', color=(1.0, 0.6, 0.0))
            elif mode==5:
                fig.gca().plot(float(self.e_txt.text),float(self.n_txt.text),'s', color=(0.75, 0.6, 0.8))
            elif mode==6:
                fig.gca().plot(float(self.e_txt.text),float(self.n_txt.text),'s', color=(0.7, 0.7, 0.1))
            fig.canvas.draw()
Example #13
0
 def setUp(self):
     from kivy.core.clipboard import Clipboard
     self._clippy = Clipboard
     clippy_types = Clipboard.get_types()
     cliptype = clippy_types[0]
     if 'UTF8_STRING' in clippy_types:
         cliptype = 'UTF8_STRING'
     self._cliptype = cliptype
Example #14
0
    def do(self, action):
        textinput = self.textinput

        global Clipboard
        if Clipboard is None:
            from kivy.core.clipboard import Clipboard

        if action == 'cut':
            Clipboard.put(textinput.selection_text, 'text/plain')
            textinput.delete_selection()
        elif action == 'copy':
            Clipboard.put(textinput.selection_text, 'text/plain')
        elif action == 'paste':
            data = Clipboard.get('text/plain')
            if data:
                textinput.delete_selection()
                textinput.insert_text(data)
Example #15
0
    def do(self, action):
        textinput = self.textinput

        global Clipboard
        if Clipboard is None:
            from kivy.core.clipboard import Clipboard

        if action == "cut":
            Clipboard.put(textinput.selection_text, "text/plain")
            textinput.delete_selection()
        elif action == "copy":
            Clipboard.put(textinput.selection_text, "text/plain")
        elif action == "paste":
            data = Clipboard.get("text/plain")
            if data:
                textinput.delete_selection()
                textinput.insert_text(data)
Example #16
0
    def _keyboard_on_key_down(self, window, keycode, text, modifiers):
        global Clipboard
        if Clipboard is None:
            from kivy.core.clipboard import Clipboard

        is_osx = sys.platform == "darwin"
        # Keycodes on OSX:
        ctrl, cmd = 64, 1024
        key, key_str = keycode

        if text and not key in (self.interesting_keys.keys() + [27]):
            # This allows *either* ctrl *or* cmd, but not both.
            if modifiers == ["ctrl"] or (is_osx and modifiers == ["meta"]):
                if key == ord("x"):  # cut selection
                    Clipboard.put(self.selection_text, "text/plain")
                    self.delete_selection()
                elif key == ord("c"):  # copy selection
                    Clipboard.put(self.selection_text, "text/plain")
                elif key == ord("v"):  # paste selection
                    data = Clipboard.get("text/plain")
                    if data:
                        self.delete_selection()
                        self.insert_text(data)
                elif key == ord("a"):  # select all
                    self.selection_from = 0
                    self.selection_to = len(self.text)
                    self._update_selection(True)
            else:
                if self._selection:
                    self.delete_selection()
                self.insert_text(text)
            # self._recalc_size()
            return

        if key == 27:  # escape
            self.focus = False
            return True
        elif key == 9:  # tab
            self.insert_text("\t")
            return True

        k = self.interesting_keys.get(key)
        if k:
            key = (None, None, k, 1)
            self._key_down(key)
Example #17
0
    def _window_on_key_down(self, window, key, scancode=None, unicode=None,
                            modifiers=None):
        global Clipboard
        if Clipboard is None:
            from kivy.core.clipboard import Clipboard

        is_osx = sys.platform == 'darwin'
        # Keycodes on OSX:
        ctrl, cmd = 64, 1024

        if unicode and not key in (self.interesting_keys.keys() + [27]):
            # This allows *either* ctrl *or* cmd, but not both.
            if modifiers == ['ctrl'] or (is_osx and modifiers == ['meta']):
                if key == ord('x'): # cut selection
                    Clipboard.put(self.selection_text, 'text/plain')
                    self.delete_selection()
                elif key == ord('c'): # copy selection
                    Clipboard.put(self.selection_text, 'text/plain')
                elif key == ord('v'): # paste selection
                    data = Clipboard.get('text/plain')
                    if data:
                        self.delete_selection()
                        self.insert_text(data)
                elif key == ord('a'): # select all
                    self.selection_from = 0
                    self.selection_to = len(self.text)
                    self._update_selection(True)
            else:
                if self._selection:
                    self.delete_selection()
                self.insert_text(unicode)
            #self._recalc_size()
            return

        if key == 27: # escape
            self.focus = False
            return True
        elif key == 9: # tab
            self.insert_text('\t')
            return True

        k = self.interesting_keys.get(key)
        if k:
            key = (None, None, k, 1)
            self._key_down(key)
Example #18
0
	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")
Example #19
0
	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_paste_point(self, *args):
     try:
         point_string = Clipboard.get('UTF8_STRING')
         lat_lon = point_string.split(",")
         lat = float(lat_lon[0])
         lon = float(lat_lon[1])
         self.ids.lat.text = str(lat)
         self.ids.lon.text = str(lon)
     except Exception:
         toast('Required format is: Latitude, Longitude\nin NN.NNNNN decimal format', True)
 def on_paste_point(self, *args):
     try:
         point_string = Clipboard.get('UTF8_STRING')
         lat_lon = point_string.split(",")
         lat = float(lat_lon[0])
         lon = float(lat_lon[1])
         self.ids.lat.text = str(lat)
         self.ids.lon.text = str(lon)
     except ValueError as e:
         Logger.error("GeoPointEditor: error handling paste: {}".format(e))
         toast('Required format is: Latitude, Longitude\nin NN.NNNNN decimal format', True)
Example #22
0
	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
Example #23
0
    def TakePictureSandGravel(self, *args):
        '''takes a picture of sand and gravel
        '''
        self.export_to_png = export_to_png

        tmp = Clipboard.paste()
        self.n_txt.text = tmp.split(':')[0]
        self.e_txt.text = tmp.split(':')[1]

        now = time.asctime().replace(' ','_').replace(':','_')

        filename = 'st'+self.txt_inpt.text+'_sandgravel_'+now+'.png'
        self.export_to_png(self.ids.camera, filename=filename)

        subprocess.Popen("python resize_n_move.py -i "+filename+" -o sandgravelimages", shell=True)

        self.textinput.text += 'Sand/Gravel image collected:\n'#+ filename.split('.png')[0]+'\n' #: '+filename+'\n'
Example #24
0
    def TakePicture(self, *args):
        '''takes a sandcam picture and saves it to the eyeball folder
        '''
        self.export_to_png = export_to_png

        tmp = Clipboard.paste()
        self.n_txt.text = tmp.split(':')[0]
        self.e_txt.text = tmp.split(':')[1]

        now = time.asctime().replace(' ','_').replace(':','_')

        filename = 'st'+self.txt_inpt.text+'_sand_'+now+'_'+self.e_txt.text+'_'+self.n_txt.text+'.png' #
        self.export_to_png(self.ids.camera, filename=filename)

        subprocess.Popen("python resize_n_move.py -i "+filename+" -o eyeballimages", shell=True)
        #subprocess.Popen("python resize_n_move.py -i "+os.path.normpath(os.path.join(os.gwtcwd(),filename))+" -o eyeballimages", shell=True)
        self.textinput.text += 'Eyeball image collected:\n'#+ filename.split('.png')[0]+'\n' #: '+filename+'\n'
Example #25
0
    def TakePicture(self):
        '''takes a picture and saves it to the folder
        '''
        self.export_to_png = export_to_png

        tmp = Clipboard.paste()
        n_txt = tmp.split(':')[0]
        e_txt = tmp.split(':')[1]

        now = time.asctime().replace(' ','_').replace(':','_')

        filename = 'im_'+now+'_'+e_txt+'_'+n_txt+'.png'
        #filename = 'im_'+now+'.png'

        self.export_to_png(self.ids.camera, filename=filename)

        subprocess.Popen("python move_polecam_im.py -i "+filename+" -o GPSCam_images", shell=True)
Example #26
0
 def aphorism_copy(self):
     """copy the current aphorism to the clipboard"""
     if not self.current_aphorism:
         return
     A = self.current_aphorism
     tpl = "\"{aphorism}\"\n  -- {author}\n\n({source})"
     quote = tpl.format(
         aphorism=A.aphorism,
         author=A.author,
         source=A.source)
     Clipboard.put(quote, 'TEXT')
     Clipboard.put(quote, 'text/plain;charset=utf-8')
     Clipboard.put(quote, 'UTF8_STRING')
     w = self.WidgetCopy()
     w.textarea_copy.text = quote
     w.open()
Example #27
0
 def on_edit_button(self, instance):
     listOptions = list()
     
     bSelection = (self.m_oEditorInput.selection_text != "")
     if bSelection:
         listOptions.append(("Cut", self.on_cut_button))
         listOptions.append(("Copy", self.on_copy_button))
     
     clipboardcontents = None
     try:
         clipboardcontents = Clipboard.get('UTF8_STRING')
     except:
         pass
     if clipboardcontents and len(clipboardcontents) > 0:
         listOptions.append(("Paste", self.on_paste_button))
     
     if bSelection:
         listOptions.append(("", None))
         listOptions.append(("Indent", self.on_indent_button))
         listOptions.append(("Unindent", self.on_unindent_button))
     
     if len(listOptions) > 0:
         self.chooseoptionpopup = ChooseOptionPopup("Edit", listOptions)
Example #28
0
def copy_proxyip(text):
    toast(f"Copied: {text}")
    Clipboard.copy(text)
Example #29
0
 def selectpaymentid(self):
     Clipboard.put(self.paymentid)
Example #30
0
 def clip (self):
     Clipboard.put(self.smanager.encrypter.decripta ( self.passwd.valor ), 'UTF8_STRING')
Example #31
0
 def selecttxid(self):
     Clipboard.put(self.txid)
Example #32
0
 def copiar(self,ref):
     toast('Numero copiado')
     numero_copiado = ref.text
     print(numero_copiado)
     Clipboard.copy(numero_copiado)
Example #33
0
 def callback(button):
     Clipboard.put(val)
Example #34
0
 def copy_results_to_clipboard(self):
     Clipboard.copy(self.log)
Example #35
0
 def update_code(code):
     self.has_code = True
     self.code = code
     self.send_button_disabled = False
     self.send_button_text = 'send'
     Clipboard.copy(code)
Example #36
0
 def copy_link(self):
     """Copy link to the clipboard available for pasting"""
     try:
         Clipboard.copy(self.url)
     except:
         self.ids.link.text = self.link_message
Example #37
0
 def on_paste_button(self):
     clipboardcontents = Clipboard.get('UTF8_STRING')
     if clipboardcontents and len(clipboardcontents) > 0:
         self.m_oEditorInput.insert_text(clipboardcontents)
Example #38
0
 def on_paste_button(self):
     clipboardcontents = Clipboard.get('UTF8_STRING')
     if clipboardcontents and len(clipboardcontents) > 0:
         self.m_oEditorInput.insert_text(clipboardcontents)
Example #39
0
 def my_copy(self, *args):
     for child in self.children:
         if child.id == 'out':
             Clipboard.copy(child.text)
Example #40
0
    def _on_keyboard_down(self, _keyboard, keycode, _text, modifiers):
        self.last_key_down = keycode
        ctrl_pressed = "ctrl" in modifiers or ("meta" in modifiers
                                               and kivy_platform == "macosx")
        shift_pressed = "shift" in modifiers
        if self.controls.note.focus:
            return  # when making notes, don't allow keyboard shortcuts
        popup = self.popup_open
        if popup:
            if keycode[1] in [
                    Theme.KEY_DEEPERANALYSIS_POPUP,
                    Theme.KEY_REPORT_POPUP,
                    Theme.KEY_TIMER_POPUP,
                    Theme.KEY_TEACHER_POPUP,
                    Theme.KEY_AI_POPUP,
                    Theme.KEY_CONFIG_POPUP,
                    Theme.KEY_CONTRIBUTE_POPUP,
            ]:  # switch between popups
                popup.dismiss()
                return
            elif keycode[1] in Theme.KEY_SUBMIT_POPUP:
                fn = getattr(popup.content, "on_submit", None)
                if fn:
                    fn()
                return
            else:
                return
        if keycode[1] == Theme.KEY_TOGGLE_CONTINUOUS_ANALYSIS:
            self.toggle_continuous_analysis()
        elif keycode[1] == Theme.KEY_TOGGLE_COORDINATES:
            self.board_gui.toggle_coordinates()
        elif keycode[1] in Theme.KEY_PAUSE_TIMER and not ctrl_pressed:
            self.controls.timer.paused = not self.controls.timer.paused
        elif keycode[1] in Theme.KEY_ZEN:
            self.zen = (self.zen + 1) % 3
        elif keycode[1] in Theme.KEY_NAV_PREV:
            self("undo", 1 + shift_pressed * 9 + ctrl_pressed * 9999)
        elif keycode[1] in Theme.KEY_NAV_NEXT:
            self("redo", 1 + shift_pressed * 9 + ctrl_pressed * 9999)
        elif keycode[1] == Theme.KEY_NAV_GAME_START:
            self("undo", 9999)
        elif keycode[1] == Theme.KEY_NAV_GAME_END:
            self("redo", 9999)
        elif keycode[1] == Theme.KEY_MOVE_TREE_MAKE_SELECTED_NODE_MAIN_BRANCH:
            self.controls.move_tree.make_selected_node_main_branch()
        elif keycode[1] == Theme.KEY_NAV_MISTAKE and not ctrl_pressed:
            self("find-mistake", "undo" if shift_pressed else "redo")
        elif keycode[
                1] == Theme.KEY_MOVE_TREE_DELETE_SELECTED_NODE and ctrl_pressed:
            self.controls.move_tree.delete_selected_node()
        elif keycode[
                1] == Theme.KEY_MOVE_TREE_TOGGLE_SELECTED_NODE_COLLAPSE and not ctrl_pressed:
            self.controls.move_tree.toggle_selected_node_collapse()
        elif keycode[1] == Theme.KEY_NEW_GAME and ctrl_pressed:
            self("new-game-popup")
        elif keycode[1] == Theme.KEY_LOAD_GAME and ctrl_pressed:
            self("analyze-sgf-popup")
        elif keycode[1] == Theme.KEY_SAVE_GAME and ctrl_pressed:
            self("save-game")
        elif keycode[1] == Theme.KEY_SAVE_GAME_AS and ctrl_pressed:
            self("save-game-as-popup")
        elif keycode[1] == Theme.KEY_COPY and ctrl_pressed:
            Clipboard.copy(self.game.root.sgf())
            self.controls.set_status(i18n._("Copied SGF to clipboard."),
                                     STATUS_INFO)
        elif keycode[1] == Theme.KEY_PASTE and ctrl_pressed:
            self.load_sgf_from_clipboard()
        elif keycode[1] == Theme.KEY_NAV_PREV_BRANCH and shift_pressed:
            self("undo", "main-branch")
        elif keycode[1] == Theme.KEY_DEEPERANALYSIS_POPUP:
            self.analysis_controls.dropdown.open_game_analysis_popup()
        elif keycode[1] == Theme.KEY_REPORT_POPUP:
            self.analysis_controls.dropdown.open_report_popup()
        elif keycode[1] == "f10" and self.debug_level >= OUTPUT_EXTRA_DEBUG:
            import yappi

            yappi.set_clock_type("cpu")
            yappi.start()
            self.log("starting profiler", OUTPUT_ERROR)
        elif keycode[1] == "f11" and self.debug_level >= OUTPUT_EXTRA_DEBUG:
            import time
            import yappi

            stats = yappi.get_func_stats()
            filename = f"callgrind.{int(time.time())}.prof"
            stats.save(filename, type="callgrind")
            self.log(f"wrote profiling results to {filename}", OUTPUT_ERROR)
        elif not ctrl_pressed:
            shortcut = self.shortcuts.get(keycode[1])
            if shortcut is not None:
                if isinstance(shortcut, Widget):
                    shortcut.trigger_action(duration=0)
                else:
                    self(*shortcut)
Example #41
0
 def import_from_clipboard():
     imported_text = Clipboard.paste()
     MDApp.get_running_app().root.get_screen(
         "importtext"
     ).ids.imported_text_field.text = f'{imported_text[:1000]} ... '
Example #42
0
 def cpClipboard(self):
     print("Copy current Kanji to clipboard")
     Clipboard.copy("{}".format(self.master_kanji.cur_framekanji))  # TODO fix UTF8
     print(Clipboard.get_types())
Example #43
0
 def copyText(self):
     show_popup()
     Clipboard.copy(self.desc.text)
Example #44
0
 def clipboard_element(self, element, widget):
     Clipboard.copy(element.text)
Example #45
0
 def copy(self):
     Clipboard.copy(self.text_input.text)
Example #46
0
 def selectAddress(self):
     """Copy address to clipboard when user clicks"""
     print('User clicked on ', self.address)
     Clipboard.put(self.address)
Example #47
0
    def _on_keyboard_down(self, _keyboard, keycode, _text, modifiers):
        self.last_key_down = keycode
        ctrl_pressed = "ctrl" in modifiers
        if self.controls.note.focus:
            return  # when making notes, don't allow keyboard shortcuts
        popup = self.popup_open
        if popup:
            if keycode[1] in ["f5", "f6", "f7", "f8",
                              "f9"]:  # switch between popups
                popup.dismiss()
                return
            elif keycode[1] in ["enter", "numpadenter"]:
                fn = getattr(popup.content, "on_submit", None)
                if fn:
                    fn()
                return
            else:
                return
        shift_pressed = "shift" in modifiers
        shortcuts = self.shortcuts
        if keycode[1] == "spacebar":
            self.toggle_continuous_analysis()
        elif keycode[1] == "k":
            self.board_gui.toggle_coordinates()
        elif keycode[1] in ["pause", "break", "f15"] and not ctrl_pressed:
            self.controls.timer.paused = not self.controls.timer.paused
        elif keycode[1] in ["`", "~", "f12"]:
            self.zen = (self.zen + 1) % 3
        elif keycode[1] in ["left", "z"]:
            self("undo", 1 + shift_pressed * 9 + ctrl_pressed * 9999)
        elif keycode[1] in ["right", "x"]:
            self("redo", 1 + shift_pressed * 9 + ctrl_pressed * 9999)
        elif keycode[1] == "home":
            self("undo", 9999)
        elif keycode[1] == "end":
            self("redo", 9999)
        elif keycode[1] == "pageup":
            self.controls.move_tree.make_selected_node_main_branch()
        elif keycode[1] == "n" and not ctrl_pressed:
            self("find-mistake", "undo" if shift_pressed else "redo")
        elif keycode[1] == "delete" and ctrl_pressed:
            self.controls.move_tree.delete_selected_node()
        elif keycode[1] == "c" and not ctrl_pressed:
            self.controls.move_tree.toggle_selected_node_collapse()
        elif keycode[1] == "n" and ctrl_pressed:
            self("new-game-popup")
        elif keycode[1] == "l" and ctrl_pressed:
            self("analyze-sgf-popup")
        elif keycode[1] == "s" and ctrl_pressed:
            self("save-game")
        elif keycode[1] == "d" and ctrl_pressed:
            self("save-game-as-popup")
        elif keycode[1] == "c" and ctrl_pressed:
            Clipboard.copy(self.game.root.sgf())
            self.controls.set_status(i18n._("Copied SGF to clipboard."),
                                     STATUS_INFO)
        elif keycode[1] == "v" and ctrl_pressed:
            self.load_sgf_from_clipboard()
        elif keycode[1] == "b" and shift_pressed:
            self("undo", "main-branch")
        elif keycode[1] in shortcuts.keys() and not ctrl_pressed:
            shortcut = shortcuts[keycode[1]]
            if isinstance(shortcut, Widget):
                shortcut.trigger_action(duration=0)
            else:
                self(*shortcut)
        elif keycode[1] == "f10" and self.debug_level >= OUTPUT_EXTRA_DEBUG:
            import yappi

            yappi.set_clock_type("cpu")
            yappi.start()
            self.log("starting profiler", OUTPUT_ERROR)
        elif keycode[1] == "f11" and self.debug_level >= OUTPUT_EXTRA_DEBUG:
            import time
            import yappi

            stats = yappi.get_func_stats()
            filename = f"callgrind.{int(time.time())}.prof"
            stats.save(filename, type="callgrind")
            self.log(f"wrote profiling results to {filename}", OUTPUT_ERROR)
Example #48
0
 def on_copy_button(self):
     selection = self.m_oEditorInput.selection_text
     if selection != "":
         Clipboard.put(selection, 'UTF8_STRING')
Example #49
0
    def copyPassword(self):
        password = self.cipher.decrypt(self.encrypted[:16],
                                       self.encrypted[16:], None).decode()
        Clipboard.copy(password)

        toast(f"{self.site} Password Copied")
Example #50
0
 def copy(self):
     return Clipboard.paste()
 def copyPathToClipboard(instance):
     environments = getAvailableEnviroments()
     python_path = os.path.join(
         os.path.dirname(environments[self.enviroment]), "python.exe")
     Clipboard.copy(python_path)
Example #52
0
 def paste(self, req='', res=''):
     Clipboard.copy(res['text'])
     self.update_cloud_clip()
 def copy_add(self, x):
     """
     Copys current address to Clipboard
     """
     Clipboard.copy(x)
Example #54
0
 def copy(self, data=''):
     Clipboard.copy(self.selection_text)
Example #55
0
 def on_clipboard(self, *args):
     '''Event handler to "Copy to Clipboard" button
     '''
     Clipboard.copy(self.txt_traceback.text)
Example #56
0
 def cut(self):
     Clipboard.copy(self.selection_text)
     self.delete_selection()
Example #57
0
 def copy_to_clipboard(self):
     Clipboard.copy(self.data)
     msg = _('Text copied to clipboard.')
     Clock.schedule_once(lambda dt: self.app.show_info(msg))
Example #58
0
 def callback_copy(self):
     with open(self.record_file, 'r') as f1:
         tmp = f1.read()
     Clipboard.copy(tmp)
Example #59
0
 def copyToClipBoard(self, instance):
     Clipboard.copy(self.selectedRelativePathLabel.text)
     print('Copied to clipboard.')
Example #60
0
 def selectaddress(self):
     Clipboard.put(self.address)