def __init__(self, parent, server=None): '''Constructor --''' gtk.TreeView.__init__(self) self.par = parent #self.context = MatchTreeContextMenu(self.app,self) if server is not None: self.serverId = server.getLocalId() self.store = OperationStore(gtk.gdk.Pixbuf, gtk.gdk.Pixbuf, str,str ,int, parent=self.par, server=server, objectStore=self.getApplication().getObjectStore()) #Icon, Name, ID, type else: self.serverId = None self.store = OperationStore(gtk.gdk.Pixbuf, gtk.gdk.Pixbuf, str,str ,int, parent=self.par, objectStore=self.getApplication().getObjectStore()) #Icon, Name, ID, type self.context = TreeContextMenu(self) self.set_model(self.store) self.col_active = gtk.TreeViewColumn('') self.col_name = gtk.TreeViewColumn(_("Operation")) self.col_invoked = gtk.TreeViewColumn(_("Invoked")) self.append_column(self.col_active) self.append_column(self.col_name) self.append_column(self.col_invoked) self.renderer_active = gtk.CellRendererPixbuf() self.renderer_name = gtk.CellRendererText() self.renderer_icon = gtk.CellRendererPixbuf() self.renderer_invoked = gtk.CellRendererText() self.col_active.pack_start(self.renderer_active,False) self.col_name.pack_start(self.renderer_icon,False) self.col_name.pack_start(self.renderer_name,True) self.col_invoked.pack_start(self.renderer_invoked,True) self.col_active.add_attribute(self.renderer_active,'pixbuf',0) self.col_name.add_attribute(self.renderer_icon,'pixbuf',1) self.col_name.add_attribute(self.renderer_name,'text',2) self.col_invoked.add_attribute(self.renderer_invoked,'text',3) #self.col_name.set_cell_data_func(self.renderer_id,self.renderId) self.col_name.set_sort_column_id(1) self.col_invoked.set_resizable(True) self.col_name.set_resizable(True) self.set_search_column(1) self.set_rules_hint(True) #self.connect("row-activated",self.cb_RowActivated) #self.connect("row-expanded",self.cb_RowExpanded) self.connect("button_press_event",self.cb_ButtonPressed)
def __init__(self, parent): """Constructor --""" gtk.TreeView.__init__(self) self.par = parent self.stateFilter = False self.store = Store( gtk.gdk.Pixbuf, str, int, parent=self.par, objectStore=self.getApplication().getObjectStore() ) # Icon, Name, ID, type self.filterstore = FilterStore( gtk.gdk.Pixbuf, str, int, parent=self.par, objectStore=self.getApplication().getObjectStore() ) self.context = TreeContextMenu(self) self.set_model(self.store) self.col_id = gtk.TreeViewColumn(_("Environment")) # self.col_name = gtk.TreeViewColumn("ObjectId") self.append_column(self.col_id) # self.append_column(self.col_name) self.renderer_name = gtk.CellRendererText() self.renderer_icon = gtk.CellRendererPixbuf() # self.renderer_id = gtk.CellRendererText() self.col_id.pack_start(self.renderer_icon, False) self.col_id.pack_start(self.renderer_name, True) # self.col_name.pack_start(self.renderer_id,True) self.col_id.add_attribute(self.renderer_icon, "pixbuf", 0) self.col_id.add_attribute(self.renderer_name, "text", 1) # self.col_name.add_attribute(self.renderer_id,'text',2) # self.col_name.set_cell_data_func(self.renderer_id,self.renderId) # self.col_name.set_sort_column_id(1) self.col_id.set_resizable(True) # self.col_name.set_resizable(True) self.set_search_column(1) self.set_rules_hint(True) self.connect("row-activated", self.cb_RowActivated) # self.connect("row-expanded",self.cb_RowExpanded) self.connect("button_press_event", self.cb_ButtonPressed) self.changeHandler = self.connect("cursor-changed", self.cb_CursorChanged)
class OperationTree(gtk.TreeView): def __init__(self, parent, server=None): '''Constructor --''' gtk.TreeView.__init__(self) self.par = parent #self.context = MatchTreeContextMenu(self.app,self) if server is not None: self.serverId = server.getLocalId() self.store = OperationStore(gtk.gdk.Pixbuf, gtk.gdk.Pixbuf, str,str ,int, parent=self.par, server=server, objectStore=self.getApplication().getObjectStore()) #Icon, Name, ID, type else: self.serverId = None self.store = OperationStore(gtk.gdk.Pixbuf, gtk.gdk.Pixbuf, str,str ,int, parent=self.par, objectStore=self.getApplication().getObjectStore()) #Icon, Name, ID, type self.context = TreeContextMenu(self) self.set_model(self.store) self.col_active = gtk.TreeViewColumn('') self.col_name = gtk.TreeViewColumn(_("Operation")) self.col_invoked = gtk.TreeViewColumn(_("Invoked")) self.append_column(self.col_active) self.append_column(self.col_name) self.append_column(self.col_invoked) self.renderer_active = gtk.CellRendererPixbuf() self.renderer_name = gtk.CellRendererText() self.renderer_icon = gtk.CellRendererPixbuf() self.renderer_invoked = gtk.CellRendererText() self.col_active.pack_start(self.renderer_active,False) self.col_name.pack_start(self.renderer_icon,False) self.col_name.pack_start(self.renderer_name,True) self.col_invoked.pack_start(self.renderer_invoked,True) self.col_active.add_attribute(self.renderer_active,'pixbuf',0) self.col_name.add_attribute(self.renderer_icon,'pixbuf',1) self.col_name.add_attribute(self.renderer_name,'text',2) self.col_invoked.add_attribute(self.renderer_invoked,'text',3) #self.col_name.set_cell_data_func(self.renderer_id,self.renderId) self.col_name.set_sort_column_id(1) self.col_invoked.set_resizable(True) self.col_name.set_resizable(True) self.set_search_column(1) self.set_rules_hint(True) #self.connect("row-activated",self.cb_RowActivated) #self.connect("row-expanded",self.cb_RowExpanded) self.connect("button_press_event",self.cb_ButtonPressed) def cb_ButtonPressed(self, widget = None, event = None, data = None): if event.button==3: x = int(event.x) y = int(event.y) pathinfo = self.get_path_at_pos(x,y) if pathinfo is not None: try: self.grab_focus() self.set_cursor(pathinfo[0],pathinfo[1],0) selection = self.get_selection() rowiter = selection.get_selected()[1] objid = self.store.get_value(rowiter,4) obj = self.store.objectStore.getLocalObjectById(objid) self.context.popup(obj,event.button,event.get_time()) except: pass def getCurrentOperation(self): selection = self.get_selection() rowiter = selection.get_selected()[1] if rowiter is None: return None opId = self.store.get_value(rowiter,4) if opId >= 0: obj = self.getApplication().getLocalObjectById(opId) return obj else: return None def getPar(self): return self.par def getApplication(self): return self.par.getApplication()
def __init__(self, parent, server=None): '''Constructor --''' gtk.TreeView.__init__(self) self.par = parent #self.context = MatchTreeContextMenu(self.app,self) if server is not None: self.serverId = server.getLocalId() self.store = OperationStore( gtk.gdk.Pixbuf, gtk.gdk.Pixbuf, str, str, int, parent=self.par, server=server, objectStore=self.getApplication().getObjectStore( )) #Icon, Name, ID, type else: self.serverId = None self.store = OperationStore( gtk.gdk.Pixbuf, gtk.gdk.Pixbuf, str, str, int, parent=self.par, objectStore=self.getApplication().getObjectStore( )) #Icon, Name, ID, type self.context = TreeContextMenu(self) self.set_model(self.store) self.col_active = gtk.TreeViewColumn('') self.col_name = gtk.TreeViewColumn(_("Operation")) self.col_invoked = gtk.TreeViewColumn(_("Invoked")) self.append_column(self.col_active) self.append_column(self.col_name) self.append_column(self.col_invoked) self.renderer_active = gtk.CellRendererPixbuf() self.renderer_name = gtk.CellRendererText() self.renderer_icon = gtk.CellRendererPixbuf() self.renderer_invoked = gtk.CellRendererText() self.col_active.pack_start(self.renderer_active, False) self.col_name.pack_start(self.renderer_icon, False) self.col_name.pack_start(self.renderer_name, True) self.col_invoked.pack_start(self.renderer_invoked, True) self.col_active.add_attribute(self.renderer_active, 'pixbuf', 0) self.col_name.add_attribute(self.renderer_icon, 'pixbuf', 1) self.col_name.add_attribute(self.renderer_name, 'text', 2) self.col_invoked.add_attribute(self.renderer_invoked, 'text', 3) #self.col_name.set_cell_data_func(self.renderer_id,self.renderId) self.col_name.set_sort_column_id(1) self.col_invoked.set_resizable(True) self.col_name.set_resizable(True) self.set_search_column(1) self.set_rules_hint(True) #self.connect("row-activated",self.cb_RowActivated) #self.connect("row-expanded",self.cb_RowExpanded) self.connect("button_press_event", self.cb_ButtonPressed)
class OperationTree(gtk.TreeView): def __init__(self, parent, server=None): '''Constructor --''' gtk.TreeView.__init__(self) self.par = parent #self.context = MatchTreeContextMenu(self.app,self) if server is not None: self.serverId = server.getLocalId() self.store = OperationStore( gtk.gdk.Pixbuf, gtk.gdk.Pixbuf, str, str, int, parent=self.par, server=server, objectStore=self.getApplication().getObjectStore( )) #Icon, Name, ID, type else: self.serverId = None self.store = OperationStore( gtk.gdk.Pixbuf, gtk.gdk.Pixbuf, str, str, int, parent=self.par, objectStore=self.getApplication().getObjectStore( )) #Icon, Name, ID, type self.context = TreeContextMenu(self) self.set_model(self.store) self.col_active = gtk.TreeViewColumn('') self.col_name = gtk.TreeViewColumn(_("Operation")) self.col_invoked = gtk.TreeViewColumn(_("Invoked")) self.append_column(self.col_active) self.append_column(self.col_name) self.append_column(self.col_invoked) self.renderer_active = gtk.CellRendererPixbuf() self.renderer_name = gtk.CellRendererText() self.renderer_icon = gtk.CellRendererPixbuf() self.renderer_invoked = gtk.CellRendererText() self.col_active.pack_start(self.renderer_active, False) self.col_name.pack_start(self.renderer_icon, False) self.col_name.pack_start(self.renderer_name, True) self.col_invoked.pack_start(self.renderer_invoked, True) self.col_active.add_attribute(self.renderer_active, 'pixbuf', 0) self.col_name.add_attribute(self.renderer_icon, 'pixbuf', 1) self.col_name.add_attribute(self.renderer_name, 'text', 2) self.col_invoked.add_attribute(self.renderer_invoked, 'text', 3) #self.col_name.set_cell_data_func(self.renderer_id,self.renderId) self.col_name.set_sort_column_id(1) self.col_invoked.set_resizable(True) self.col_name.set_resizable(True) self.set_search_column(1) self.set_rules_hint(True) #self.connect("row-activated",self.cb_RowActivated) #self.connect("row-expanded",self.cb_RowExpanded) self.connect("button_press_event", self.cb_ButtonPressed) def cb_ButtonPressed(self, widget=None, event=None, data=None): if event.button == 3: x = int(event.x) y = int(event.y) pathinfo = self.get_path_at_pos(x, y) if pathinfo is not None: try: self.grab_focus() self.set_cursor(pathinfo[0], pathinfo[1], 0) selection = self.get_selection() rowiter = selection.get_selected()[1] objid = self.store.get_value(rowiter, 4) obj = self.store.objectStore.getLocalObjectById(objid) self.context.popup(obj, event.button, event.get_time()) except: pass def getCurrentOperation(self): selection = self.get_selection() rowiter = selection.get_selected()[1] if rowiter is None: return None opId = self.store.get_value(rowiter, 4) if opId >= 0: obj = self.getApplication().getLocalObjectById(opId) return obj else: return None def getPar(self): return self.par def getApplication(self): return self.par.getApplication()
class Tree(gtk.TreeView): def __init__(self, parent): """Constructor --""" gtk.TreeView.__init__(self) self.par = parent self.stateFilter = False self.store = Store( gtk.gdk.Pixbuf, str, int, parent=self.par, objectStore=self.getApplication().getObjectStore() ) # Icon, Name, ID, type self.filterstore = FilterStore( gtk.gdk.Pixbuf, str, int, parent=self.par, objectStore=self.getApplication().getObjectStore() ) self.context = TreeContextMenu(self) self.set_model(self.store) self.col_id = gtk.TreeViewColumn(_("Environment")) # self.col_name = gtk.TreeViewColumn("ObjectId") self.append_column(self.col_id) # self.append_column(self.col_name) self.renderer_name = gtk.CellRendererText() self.renderer_icon = gtk.CellRendererPixbuf() # self.renderer_id = gtk.CellRendererText() self.col_id.pack_start(self.renderer_icon, False) self.col_id.pack_start(self.renderer_name, True) # self.col_name.pack_start(self.renderer_id,True) self.col_id.add_attribute(self.renderer_icon, "pixbuf", 0) self.col_id.add_attribute(self.renderer_name, "text", 1) # self.col_name.add_attribute(self.renderer_id,'text',2) # self.col_name.set_cell_data_func(self.renderer_id,self.renderId) # self.col_name.set_sort_column_id(1) self.col_id.set_resizable(True) # self.col_name.set_resizable(True) self.set_search_column(1) self.set_rules_hint(True) self.connect("row-activated", self.cb_RowActivated) # self.connect("row-expanded",self.cb_RowExpanded) self.connect("button_press_event", self.cb_ButtonPressed) self.changeHandler = self.connect("cursor-changed", self.cb_CursorChanged) def render(self): filterString = self.getApplication().mainwin.getFilterText() if filterString != "": self.filterstore.render(filterString) self.disconnect(self.changeHandler) self.set_model(self.filterstore) self.set_cursor((0,)) self.stateFilter = True else: self.set_model(self.store) self.changeHandler = self.connect("cursor-changed", self.cb_CursorChanged) self.stateFilter = False def cb_CursorChanged(self, data): selection = self.get_selection() rowiter = selection.get_selected()[1] if rowiter is None or not self.store.iter_is_valid(rowiter): return nr = self.store.get_value(rowiter, 2) if nr is not None and not nr >= 0: self.getPar().getToolbar().clearButtons() return obj = self.store.objectStore.getLocalObjectById(nr) self.getPar().getToolbar().renderContextButtons(obj) self.getPar().getTabs().openPage(obj, False) def cb_ButtonPressed(self, widget=None, event=None, data=None): if event.button == 3: x = int(event.x) y = int(event.y) pathinfo = self.get_path_at_pos(x, y) if pathinfo is not None: self.grab_focus() self.set_cursor(pathinfo[0], pathinfo[1], 0) selection = self.get_selection() rowiter = selection.get_selected()[1] nr = self.store.get_value(rowiter, 2) if nr == -2: # is Root-object: self.getPar().getToolbar().clearButtons() return obj = self.store.objectStore.getLocalObjectById(nr) self.context.popup(obj, event.button, event.get_time()) self.getPar().getToolbar().renderContextButtons(obj) def cb_RowActivated(self, treeview, rowiter, path, wdata=None): """This callbackmethod defines behaviour after doubleclicking a row. It is calling open match if the currently selected treeelement is representing a match""" selection = self.get_selection() rowiter = selection.get_selected()[1] if self.stateFilter: nr = self.filterstore.get_value(rowiter, 2) else: nr = self.store.get_value(rowiter, 2) if nr >= 0: object = self.getApplication().getLocalObjectById(nr) self.getPar().getTabs().openPage(object) def setActiveObject(self, obj): rowiter = self.store.getIterById(obj.getLocalId()) path = self.store.get_path(rowiter) self.set_cursor(path) def getPar(self): return self.par def getApplication(self): return self.par.getApplication()