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
Exemplo n.º 2
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
Exemplo n.º 3
0
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))
Exemplo n.º 4
0
    def on_update(self, dt):
        """
        on_update callback gets clipboard and decides
        if the value is different than the value previously stored.
        """
        if 'text/plain' == ''.join(Clipboard.get_types()[0]):
            # Logger.info(Clippy.get_types())
            if Clipboard.paste():
                data = Clipboard.paste()  # Gets the data currently in the clipboard
            else:
                data = None
        else:
            Logger.info('on_update', Clipboard.get_types())
            data = 'Unsupported type'

        if data != self.last_record:
            self.db.insert_new_record(self.conn, data)
            self.last_record = data
            self.data_model.clip_text += ('\nClip {0}:\n{1}'.format(self.times_updated, data))
            self.times_updated += 1
Exemplo n.º 5
0
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))
Exemplo n.º 6
0
    def _paste(self):
        self._ensure_clipboard()
        _clip_types = Clipboard.get_types()

        mime_type = self._clip_mime_type
        if mime_type not in _clip_types:
            mime_type = 'text/plain'

        data = Clipboard.get(mime_type)
        if data is not None:
            data = data.decode(self._encoding, 'ignore')
            # remove null strings mostly a windows issue
            data = data.replace('\x00', '')
            self.delete_selection()
            self.insert_text(data)
Exemplo n.º 7
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())
Exemplo n.º 8
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())