예제 #1
0
class ReadOnlyTextWidget:
    copyAll = lambda self, item: setClipboard(toStr(self.get_text()))

    def has_selection():
        raise NotImplementedError

    def labelMenuAddCopyItems(self, menu):
        menu.add(
            labelStockMenuItem(
                'Copy _All',
                gtk.STOCK_COPY,
                self.copyAll,
            ))
        ####
        itemCopy = labelStockMenuItem(
            '_Copy',
            gtk.STOCK_COPY,
            self.copy,
        )
        if not self.has_selection():
            itemCopy.set_sensitive(False)
        menu.add(itemCopy)

    def onPopup(self, widget, menu):
        menu = gtk.Menu()
        self.labelMenuAddCopyItems(menu)
        ####
        menu.show_all()
        self.tmpMenu = menu
        menu.popup(None, None, None, None, 3, 0)
        ui.updateFocusTime()
예제 #2
0
class ReadOnlyTextWidget:
    copyAll = lambda self, item: setClipboard(toStr(self.get_text()))

    def has_selection():
        raise NotImplementedError

    def onPopup(self, widget, menu):
        # instead of creating a new menu, we should remove all the current items from current menu
        for item in menu.get_children():
            menu.remove(item)
        ####
        menu.add(
            labelStockMenuItem(
                'Copy _All',
                gtk.STOCK_COPY,
                self.copyAll,
            ))
        ####
        itemCopy = labelStockMenuItem(
            '_Copy',
            gtk.STOCK_COPY,
            self.copy,
        )
        if not self.has_selection():
            itemCopy.set_sensitive(False)
        menu.add(itemCopy)
        ####
        menu.show_all()
        self.tmpMenu = menu
        ui.updateFocusTime()
예제 #3
0
class DateLabel(gtk.Label):
    def __init__(self, text=None):
        gtk.Label.__init__(self, text)
        self.set_selectable(True)
        #self.set_cursor_visible(False)## FIXME
        self.set_can_focus(False)
        self.set_use_markup(True)
        self.connect('populate-popup', self.popupPopulate)
        ####
        self.menu = gtk.Menu()
        ##
        itemCopyAll = ImageMenuItem(_('Copy _All'))
        itemCopyAll.set_image(gtk.Image.new_from_stock(gtk.STOCK_COPY, gtk.IconSize.MENU))
        itemCopyAll.connect('activate', self.copyAll)
        self.menu.add(itemCopyAll)
        ##
        itemCopy = ImageMenuItem(_('_Copy'))
        itemCopy.set_image(gtk.Image.new_from_stock(gtk.STOCK_COPY, gtk.IconSize.MENU))
        itemCopy.connect('activate', self.copy)
        self.itemCopy = itemCopy
        self.menu.add(itemCopy)
        ##
        self.menu.show_all()
    def popupPopulate(self, label, menu):
        self.itemCopy.set_sensitive(self.get_property('cursor-position') > self.get_property('selection-bound'))## FIXME
        self.menu.popup(None, None, None, None, 3, 0)
        ui.updateFocusTime()
    def copy(self, item):
        start = self.get_property('selection-bound')
        end = self.get_property('cursor-position')
        setClipboard(toStr(self.get_text())[start:end])
    copyAll = lambda self, label: setClipboard(self.get_text())
예제 #4
0
 def copyAll(self, label):
     setClipboard(self.get_text())
예제 #5
0
 def copy(self, item):
     start = self.get_property("selection-bound")
     end = self.get_property("cursor-position")
     setClipboard(toStr(self.get_text())[start:end])
예제 #6
0
파일: datelabel.py 프로젝트: ilius/starcal
	def copyAll(self, label):
		setClipboard(self.get_text())
예제 #7
0
파일: datelabel.py 프로젝트: ilius/starcal
	def copy(self, item):
		start = self.get_property("selection-bound")
		end = self.get_property("cursor-position")
		setClipboard(toStr(self.get_text())[start:end])
예제 #8
0
 def copy(self, item):
     buf = self.get_buffer()
     start_iter, end_iter = buf.get_selection_bounds()
     setClipboard(toStr(buf.get_text(start_iter, end_iter, True)))
예제 #9
0
 def copy(self, item):
     bound = self.get_selection_bound()
     cursor = self.get_cursor_position()
     start = min(bound, cursor)
     end = max(bound, cursor)
     setClipboard(toStr(self.get_text())[start:end])
예제 #10
0
 def copyAll(self, item):
     return setClipboard(toStr(self.get_text()))
예제 #11
0
 def copy(self, item):
     buf = self.get_buffer()
     start_iter, end_iter = buf.get_selection_bounds()
     setClipboard(toStr(buf.get_text(start_iter, end_iter, True)))
예제 #12
0
 def copy(self, item):
     bound = self.get_selection_bound()
     cursor = self.get_cursor_position()
     start = min(bound, cursor)
     end = max(bound, cursor)
     setClipboard(toStr(self.get_text())[start:end])
예제 #13
0
	def copyAll(self, item):
		return setClipboard(toStr(self.get_text()))