Example #1
0
def icopy(win):
    focustext = win.textobj.getfocustext()
    if not focustext:
        stdwin.fleep()
    else:
        stdwin.rotatecutbuffers(1)
        stdwin.setcutbuffer(0, focustext)
Example #2
0
def icopy(win):
	focustext = win.textobj.getfocustext()
	if not focustext:
		stdwin.fleep()
	else:
		stdwin.rotatecutbuffers(1)
		stdwin.setcutbuffer(0, focustext)
Example #3
0
	def make_selection(self):
		s = self.tefocus.getfocustext()
		if not s:
			return
		stdwin.rotatecutbuffers(1)
		stdwin.setcutbuffer(0, s)
		if not self.window.setselection(WS_PRIMARY, s):
			stdwin.fleep()
Example #4
0
	def mouse_up(self, detail):
		if self.last_mouse_down:
			h1, v1 = self.last_mouse_down[0]
			h2, v2 = detail[0]
			long1 = self.cur_backend.whereis(stdwin, h1, v1)
			long2 = self.cur_backend.whereis(stdwin, h2, v2)
			if not long1 or not long2:
				return
			long1, long2 = self.roundpositions(long1, long2)
			self.cur_backend.setselection((long1, long2))
			#
			selection = self.cur_backend.extractpart(long1, long2)
			if not selection:
				return
			if not self.window.setselection(WS_PRIMARY, selection):
				# Meaning some other application got it now
				stdwin.fleep()
				return
			stdwin.rotatecutbuffers(1)
			stdwin.setcutbuffer(0, selection)
			return
		h, v = detail[0]
		hits = self.cur_backend.hitcheck(h, v)
		if not hits:
			return
		if len(hits) > 1:
			stdwin.message('Please click in exactly one anchor')
			return
		id = hits[0]
		if 1 <= id <= len(self.cur_anchors):
			addr = self.cur_anchors[id-1]
			name = self.cur_anchornames[id-1]
			type = self.cur_anchortypes[id-1]
			button = detail[2]
			if button == 2:
				if name:
					msg = 'NAME="' + name + '" '
				else:
					msg = ''
				if addr:
					msg = msg + 'HREF="' + addr + '"'
				stdwin.message(msg)
			elif addr[:7] == 'telnet:':
				self.telnet(addr)
			elif button == 3 and addr and addr[0] <> '#':
				addr = self.full_addr(addr)
				w = self.new()
				history = self.history + [self.cur_addr]
				if not w.setaddr(addr):
					w.close()
					stdwin.message(addr + ': ' + \
						self.last_msg)
				else:
					w.set_history(history)
			else:
				self.follow(addr)
		else:
			stdwin.message('Strange - bad anchor id???')
Example #5
0
 def mouse_up(self, detail):
     if self.last_mouse_down:
         h1, v1 = self.last_mouse_down[0]
         h2, v2 = detail[0]
         long1 = self.cur_backend.whereis(stdwin, h1, v1)
         long2 = self.cur_backend.whereis(stdwin, h2, v2)
         if not long1 or not long2:
             return
         long1, long2 = self.roundpositions(long1, long2)
         self.cur_backend.setselection((long1, long2))
         #
         selection = self.cur_backend.extractpart(long1, long2)
         if not selection:
             return
         if not self.window.setselection(WS_PRIMARY, selection):
             # Meaning some other application got it now
             stdwin.fleep()
             return
         stdwin.rotatecutbuffers(1)
         stdwin.setcutbuffer(0, selection)
         return
     h, v = detail[0]
     hits = self.cur_backend.hitcheck(h, v)
     if not hits:
         return
     if len(hits) > 1:
         stdwin.message('Please click in exactly one anchor')
         return
     id = hits[0]
     if 1 <= id <= len(self.cur_anchors):
         addr = self.cur_anchors[id - 1]
         name = self.cur_anchornames[id - 1]
         type = self.cur_anchortypes[id - 1]
         button = detail[2]
         if button == 2:
             if name:
                 msg = 'NAME="' + name + '" '
             else:
                 msg = ''
             if addr:
                 msg = msg + 'HREF="' + addr + '"'
             stdwin.message(msg)
         elif addr[:7] == 'telnet:':
             self.telnet(addr)
         elif button == 3 and addr and addr[0] <> '#':
             addr = self.full_addr(addr)
             w = self.new()
             history = self.history + [self.cur_addr]
             if not w.setaddr(addr):
                 w.close()
                 stdwin.message(addr + ': ' + \
                  self.last_msg)
             else:
                 w.set_history(history)
         else:
             self.follow(addr)
     else:
         stdwin.message('Strange - bad anchor id???')
def do_copy(window):
	selection = window.textobject.getfocustext()
	if not selection:
		stdwin.fleep()		# Nothing to cut
	elif not window.setselection(WS_PRIMARY, selection):
		stdwin.fleep()		# Window manager glitch...
	else:
		stdwin.rotatecutbuffers(1)
		stdwin.setcutbuffer(0, selection)
def do_cut(window):
	selection = window.textobject.getfocustext()
	if not selection:
		stdwin.fleep()		# Nothing to cut
	elif not window.setselection(WS_PRIMARY, selection):
		stdwin.fleep()		# Window manager glitch...
	else:
		stdwin.rotatecutbuffers(1)
		stdwin.setcutbuffer(0, selection)
		window.textobject.replace('')
		window.changed = 1
		fix_docsize(window)