Beispiel #1
0
 def __init__(self, name='TwinCList'):
     HPaned.__init__(self)
     self.set_name(name)
     self.Lbox = ListBox([], name='%s-left' % name, columns=[])
     self.Rbox = ListBox([], name='%s-right' % name, columns=[])
     self.add1(self.Lbox)
     self.add2(self.Rbox)
     self.show()
Beispiel #2
0
 def __init__(self, name='TwinCList'):
     HPaned.__init__(self)
     self.set_name(name)
     self.Lbox = ListBox([], name='%s-left' %name, columns=[])
     self.Rbox = ListBox([], name='%s-right' %name, columns=[])
     self.add1(self.Lbox)
     self.add2(self.Rbox)
     self.show()
Beispiel #3
0
class TwinCList(HPaned):
    def __init__(self, name='TwinCList'):
        HPaned.__init__(self)
        self.set_name(name)
        self.Lbox = ListBox([], name='%s-left' % name, columns=[])
        self.Rbox = ListBox([], name='%s-right' % name, columns=[])
        self.add1(self.Lbox)
        self.add2(self.Rbox)
        self.show()

    def Lfill(self, rows, columns):
        self.Lbox.destroy()
        self.Lbox = ListBox(rows, name='left', columns=columns)
        self.add1(self.Lbox)

    def Rfill(self, rows, columns):
        self.Rbox.destroy()
        self.Rbox = ListBox(rows, name='right', columns=columns)
        self.add1(self.Rbox)
Beispiel #4
0
 def _make_listbox(self, rowlist, columns):
     if self.listbox:
         self.listbox.destroy()
         self.listbox = None
     self.listbox = ListBox(rowlist, name=self.get_name(), columns=columns)
     #self.columns = self.listbox._col_titles
     #self.scroll.add_with_viewport(self.listbox)
     self.listbox.set_name(self._name)
     self.__lb_container__.add(self.listbox)
     if self._rcfun:
         event = 'button_press_event'
         if self._rcmenu:
             self.listbox.connect(event, self._rcfun, self._rcmenu)
         else:
             self.listbox.connect(event, self._rcfun)
     if self._dnd:
         self.listbox.connect('drag_data_get', self._dnd)
         self.listbox.drag_source_set(BUTTON1_MASK, self._targets_,
                                      ACTION_COPY)
Beispiel #5
0
class TwinCList(HPaned):
    def __init__(self, name='TwinCList'):
        HPaned.__init__(self)
        self.set_name(name)
        self.Lbox = ListBox([], name='%s-left' %name, columns=[])
        self.Rbox = ListBox([], name='%s-right' %name, columns=[])
        self.add1(self.Lbox)
        self.add2(self.Rbox)
        self.show()

    def Lfill(self, rows, columns):
        self.Lbox.destroy()
        self.Lbox = ListBox(rows, name='left', columns=columns)
        self.add1(self.Lbox)

    def Rfill(self, rows, columns):
        self.Rbox.destroy()
        self.Rbox = ListBox(rows, name='right', columns=columns)
        self.add1(self.Rbox)
    def _make_listbox(self, rowlist, columns):
        if self.listbox:
            self.listbox.destroy()
            self.listbox=None
        self.listbox = ListBox(rowlist, name=self.get_name(),
                               columns=columns)
        #self.columns = self.listbox._col_titles
        #self.scroll.add_with_viewport(self.listbox)
        self.listbox.set_name(self._name)
        self.__lb_container__.add(self.listbox)
        if self._rcfun:
	    event = 'button_press_event'
	    if self._rcmenu:
		self.listbox.connect(event, self._rcfun, self._rcmenu)
	    else:
		self.listbox.connect(event, self._rcfun)
        if self._dnd:
            self.listbox.connect('drag_data_get', self._dnd)
            self.listbox.drag_source_set(BUTTON1_MASK, self._targets_,
					 ACTION_COPY)
Beispiel #7
0
 def Rfill(self, rows, columns):
     self.Rbox.destroy()
     self.Rbox = ListBox(rows, name='right', columns=columns)
     self.add1(self.Rbox)
Beispiel #8
0
 def Lfill(self, rows, columns):
     self.Lbox.destroy()
     self.Lbox = ListBox(rows, name='left', columns=columns)
     self.add1(self.Lbox)
Beispiel #9
0
class HasListbox(object):
    def __init__(self,
                 container,
                 name='HasListbox',
                 rcfun=None,
                 dnd=None,
                 targets=[],
                 rcmenu=None):
        object.__init__(self)
        if rcmenu and not rcfun:
            self._rcfun = right_click_menu
        else:
            self._rcfun = rcfun
        self._rcmenu = rcmenu
        self._dnd = dnd
        self.listbox = None
        self.__lb_container__ = container
        self._name = name
        self._targets_ = targets

    def set_rows(self, rowlist, columns=[]):
        self.rows = rowlist
        self._make_listbox(self.rows, columns)

    def set_row_select(self, select_fun):
        self.listbox.set_row_select(select_fun)

    def set_right_click(self, function):
        self._rcfun = function
        print '_rcfun', self._rcfun

    def _make_listbox(self, rowlist, columns):
        if self.listbox:
            self.listbox.destroy()
            self.listbox = None
        self.listbox = ListBox(rowlist, name=self.get_name(), columns=columns)
        #self.columns = self.listbox._col_titles
        #self.scroll.add_with_viewport(self.listbox)
        self.listbox.set_name(self._name)
        self.__lb_container__.add(self.listbox)
        if self._rcfun:
            event = 'button_press_event'
            if self._rcmenu:
                self.listbox.connect(event, self._rcfun, self._rcmenu)
            else:
                self.listbox.connect(event, self._rcfun)
        if self._dnd:
            self.listbox.connect('drag_data_get', self._dnd)
            self.listbox.drag_source_set(BUTTON1_MASK, self._targets_,
                                         ACTION_COPY)

    def drag_rows(self, listbox, context, selection, targettype, time):
        selection.set(selection.target, 0, listbox.get_selected_data())

    def set_select_mode(self, type='single'):
        self.select_state = type
        if type == 'multi':
            self.listbox.set_selection_mode(SELECTION_MULTIPLE)
        elif type == 'extended':
            self.listbox.set_selection_mode(SELECTION_EXTENDED)
        else:
            self.listbox.set_selection_mode(SELECTION_SINGLE)

    def get_selected_data(self):
        return self.listbox.get_selected_data()
Beispiel #10
0
class HasListbox(object):
    def __init__(self, container, name='HasListbox',
		 rcfun=None, dnd=None, targets=[], rcmenu=None):
        object.__init__(self)
        if rcmenu and not rcfun:
            self._rcfun = right_click_menu
        else:
            self._rcfun = rcfun
        self._rcmenu = rcmenu
        self._dnd = dnd
        self.listbox = None
        self.__lb_container__ = container
        self._name = name
        self._targets_ = targets
        
    def set_rows(self, rowlist, columns=[]):
        self.rows = rowlist
        self._make_listbox(self.rows, columns)

    def set_row_select(self, select_fun):
        self.listbox.set_row_select(select_fun)

    def set_right_click(self, function):
        self._rcfun = function
        print '_rcfun', self._rcfun
        
    def _make_listbox(self, rowlist, columns):
        if self.listbox:
            self.listbox.destroy()
            self.listbox=None
        self.listbox = ListBox(rowlist, name=self.get_name(),
                               columns=columns)
        #self.columns = self.listbox._col_titles
        #self.scroll.add_with_viewport(self.listbox)
        self.listbox.set_name(self._name)
        self.__lb_container__.add(self.listbox)
        if self._rcfun:
	    event = 'button_press_event'
	    if self._rcmenu:
		self.listbox.connect(event, self._rcfun, self._rcmenu)
	    else:
		self.listbox.connect(event, self._rcfun)
        if self._dnd:
            self.listbox.connect('drag_data_get', self._dnd)
            self.listbox.drag_source_set(BUTTON1_MASK, self._targets_,
					 ACTION_COPY)
    def drag_rows(self, listbox, context, selection,
                  targettype, time):
        selection.set(selection.target, 0, listbox.get_selected_data())

    def set_select_mode(self, type='single'):
        self.select_state = type
        if type == 'multi':
            self.listbox.set_selection_mode(SELECTION_MULTIPLE)
        elif type == 'extended':
            self.listbox.set_selection_mode(SELECTION_EXTENDED)
        else:
            self.listbox.set_selection_mode(SELECTION_SINGLE)
            
    def get_selected_data(self):
        return self.listbox.get_selected_data()
Beispiel #11
0
 def Rfill(self, rows, columns):
     self.Rbox.destroy()
     self.Rbox = ListBox(rows, name='right', columns=columns)
     self.add1(self.Rbox)
Beispiel #12
0
 def Lfill(self, rows, columns):
     self.Lbox.destroy()
     self.Lbox = ListBox(rows, name='left', columns=columns)
     self.add1(self.Lbox)