(self, stuff)
Copy stuff to clipboard
Copy stuff to clipboard
Copy stuff to clipboard
def cp2cb(self, stuff):
        '''Copy stuff to clipboard'''

        if stuff is not None:
            try:
                if platform != 'darwin':
                    Popen(['xsel', '-pc', '-l', '/dev/null'], stderr=PIPE, stdout=PIPE)
                    Popen(['xsel', '-bc', '-l', '/dev/null'], stderr=PIPE, stdout=PIPE)
                    Popen(['xsel', '-pi', '-l', '/dev/null'], stdin=PIPE, stderr=PIPE,
                          stdout=PIPE).communicate(stuff.encode())
                    Popen(['xsel', '-bi', '-l', '/dev/null'], stdin=PIPE, stderr=PIPE,
                          stdout=PIPE).communicate(stuff.encode())
                else:
                    Popen(['pbcopy', '-pboard', 'general'], stdin=PIPE,
                          stderr=PIPE, stdout=PIPE).communicate(b'')
                    Popen(['pbcopy', '-pboard', 'general'], stdin=PIPE,
                          stderr=PIPE, stdout=PIPE).communicate(stuff.encode())
                if self.control.config['del_clip'] is True:
                    if type(self.clip_timer) is threading.Timer:
                        self.clip_timer.cancel()
                    self.clip_timer = threading.Timer(
                        self.control.config['clip_delay'],
                        self.del_clipboard)
                    self.clip_timer.start()
            except FileNotFoundError as err:
                self.control.draw_text(False,
                                       (1, 0, err.__str__()),
                                       (4, 0, 'Press any key.'))
                if self.control.any_key() == -1:
                    self.close()
            else:
                self.cb = stuff
def cp2cb ( self , stuff ) : if stuff is not None : try : if platform != 'darwin' : Popen ( [ 'xsel' , '-pc' , '-l' , '/dev/null' ] , stderr = PIPE , stdout = PIPE ) Popen ( [ 'xsel' , '-bc' , '-l' , '/dev/null' ] , stderr = PIPE , stdout = PIPE ) Popen ( [ 'xsel' , '-pi' , '-l' , '/dev/null' ] , stdin = PIPE , stderr = PIPE , stdout = PIPE ) . communicate ( stuff . encode ( ) ) Popen ( [ 'xsel' , '-bi' , '-l' , '/dev/null' ] , stdin = PIPE , stderr = PIPE , stdout = PIPE ) . communicate ( stuff . encode ( ) ) else : Popen ( [ 'pbcopy' , '-pboard' , 'general' ] , stdin = PIPE , stderr = PIPE , stdout = PIPE ) . communicate ( b'' ) Popen ( [ 'pbcopy' , '-pboard' , 'general' ] , stdin = PIPE , stderr = PIPE , stdout = PIPE ) . communicate ( stuff . encode ( ) ) if self . control . config [ 'del_clip' ] is True : if type ( self . clip_timer ) is threading . Timer : self . clip_timer . cancel ( ) self . clip_timer = threading . Timer ( self . control . config [ 'clip_delay' ] , self . del_clipboard ) self . clip_timer . start ( ) except FileNotFoundError as err : self . control . draw_text ( False , ( 1 , 0 , err . __str__ ( ) ) , ( 4 , 0 , 'Press any key.' ) ) if self . control . any_key ( ) == - 1 : self . close ( ) else : self . cb = stuff