Python gtk.TreeViewColumn() Examples

The following are 30 code examples of gtk.TreeViewColumn(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module gtk , or try the search function .
Example #1
Source File: show_last_packets.py    From royal-chaos with MIT License 6 votes vote down vote up
def __init__(self):
            """
            Initializer
            @param self this object
            """
            super(ShowLastPackets.PacketList, self).__init__()
            self.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
                                vscrollbar_policy=gtk.POLICY_AUTOMATIC)
            self.table_model = gtk.ListStore(*([str]*4))
            treeview = gtk.TreeView(self.table_model)
            treeview.show()
            self.add(treeview)

            def add_column(descr, colid):
                column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
                treeview.append_column(column)

            add_column("Time", self.COLUMN_TIME)
            add_column("Interface", self.COLUMN_INTERFACE)
            add_column("Size", self.COLUMN_SIZE)
            add_column("Contents", self.COLUMN_CONTENTS) 
Example #2
Source File: radmin.py    From rpy2 with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, rfunction):
        super(FunctionPanel, self).__init__()
        self._rfunction = rfunction
        formals = self._as_list(rfunction.formals())
        formals_value = [x for x in formals.rx(-1)]
        formals_name = [x for x in formals.rx(-1).names]
        self._table = gtk.ListStore(str, str)
        self._treeView = gtk.TreeView(model = self._table)
        self._treeView.show()
        self._valueColumns = [gtk.TreeViewColumn('parameter'),
                              gtk.TreeViewColumn('value'),]
        self._valueCells = []
        for col_i, col in enumerate(self._valueColumns):
            self._treeView.append_column(col)
            cr = gtk.CellRendererText()
            col.pack_start(cr, True)
            self._valueCells.append(cr)
            col.set_attributes(cr, text=col_i)

        for name, value in itertools.izip(formals_name, formals_value):
            row = (name, value)
            self._table.append(row)
            
        sbox = gtk.HBox(homogeneous=False, spacing=0)
        sbox.show() 
Example #3
Source File: show_last_packets.py    From Tocino with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self):
            super(ShowLastPackets.PacketList, self).__init__()
            self.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
                                vscrollbar_policy=gtk.POLICY_AUTOMATIC)
            self.table_model = gtk.ListStore(*([str]*4))
            treeview = gtk.TreeView(self.table_model)
            treeview.show()
            self.add(treeview)

            def add_column(descr, colid):
                column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
                treeview.append_column(column)

            add_column("Time", self.COLUMN_TIME)
            add_column("Interface", self.COLUMN_INTERFACE)
            add_column("Size", self.COLUMN_SIZE)
            add_column("Contents", self.COLUMN_CONTENTS) 
Example #4
Source File: show_last_packets.py    From IEEE-802.11ah-ns-3 with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self):
            super(ShowLastPackets.PacketList, self).__init__()
            self.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
                                vscrollbar_policy=gtk.POLICY_AUTOMATIC)
            self.table_model = gtk.ListStore(*([str]*4))
            treeview = gtk.TreeView(self.table_model)
            treeview.show()
            self.add(treeview)

            def add_column(descr, colid):
                column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
                treeview.append_column(column)

            add_column("Time", self.COLUMN_TIME)
            add_column("Interface", self.COLUMN_INTERFACE)
            add_column("Size", self.COLUMN_SIZE)
            add_column("Contents", self.COLUMN_CONTENTS) 
Example #5
Source File: show_last_packets.py    From ntu-dsi-dcn with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self):
            super(ShowLastPackets.PacketList, self).__init__()
            self.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
                                vscrollbar_policy=gtk.POLICY_AUTOMATIC)
            self.table_model = gtk.ListStore(*([str]*4))
            treeview = gtk.TreeView(self.table_model)
            treeview.show()
            self.add(treeview)

            def add_column(descr, colid):
                column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
                treeview.append_column(column)

            add_column("Time", self.COLUMN_TIME)
            add_column("Interface", self.COLUMN_INTERFACE)
            add_column("Size", self.COLUMN_SIZE)
            add_column("Contents", self.COLUMN_CONTENTS) 
Example #6
Source File: gnome_connection_manager.py    From gnome-connection-manager with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, path="gnome-connection-manager.glade",
                 root="wHost",
                 domain=domain_name, **kwargs):
        path = os.path.join(glade_dir, path)
        SimpleGladeApp.__init__(self, path, root, domain, **kwargs)
        
        self.treeModel = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
        self.treeTunel.set_model(self.treeModel)
        column = gtk.TreeViewColumn(_("Local"), gtk.CellRendererText(), text=0)
        self.treeTunel.append_column( column )        
        column = gtk.TreeViewColumn(_("Host"), gtk.CellRendererText(), text=1)
        self.treeTunel.append_column( column )        
        column = gtk.TreeViewColumn(_("Remoto"), gtk.CellRendererText(), text=2)
        self.treeTunel.append_column( column )        


    #-- Whost.new { 
Example #7
Source File: gnome_connection_manager.py    From gnome-connection-manager with GNU General Public License v3.0 6 votes vote down vote up
def new(self):        
        self.treeHosts = self.get_widget('treeHosts')
        self.treeStore = gtk.TreeStore( gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_OBJECT )
        for x in self.terms:
            self.treeStore.append( None, (False, x[0], x[1]) )
        self.treeHosts.set_model( self.treeStore )               
        
        crt = gtk.CellRendererToggle()
        crt.set_property('activatable', True)
        crt.connect('toggled', self.on_active_toggled)        
        col = gtk.TreeViewColumn(_("Activar"), crt, active=0)               
        self.treeHosts.append_column( col )
        self.treeHosts.append_column(gtk.TreeViewColumn(_("Host"), gtk.CellRendererText(), text=1 ))
        self.get_widget("txtCommands").history = []
    #-- Wcluster.new }

    #-- Wcluster custom methods {
    #   Write your own methods here 
Example #8
Source File: show_last_packets.py    From ns3-load-balance with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self):
            super(ShowLastPackets.PacketList, self).__init__()
            self.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
                                vscrollbar_policy=gtk.POLICY_AUTOMATIC)
            self.table_model = gtk.ListStore(*([str]*4))
            treeview = gtk.TreeView(self.table_model)
            treeview.show()
            self.add(treeview)

            def add_column(descr, colid):
                column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
                treeview.append_column(column)

            add_column("Time", self.COLUMN_TIME)
            add_column("Interface", self.COLUMN_INTERFACE)
            add_column("Size", self.COLUMN_SIZE)
            add_column("Contents", self.COLUMN_CONTENTS) 
Example #9
Source File: show_last_packets.py    From ns3-802.11ad with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self):
            """
            Initializer
            @param self this object
            """
            super(ShowLastPackets.PacketList, self).__init__()
            self.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
                                vscrollbar_policy=gtk.POLICY_AUTOMATIC)
            self.table_model = gtk.ListStore(*([str]*4))
            treeview = gtk.TreeView(self.table_model)
            treeview.show()
            self.add(treeview)

            def add_column(descr, colid):
                column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
                treeview.append_column(column)

            add_column("Time", self.COLUMN_TIME)
            add_column("Interface", self.COLUMN_INTERFACE)
            add_column("Size", self.COLUMN_SIZE)
            add_column("Contents", self.COLUMN_CONTENTS) 
Example #10
Source File: _inspectro.py    From BitTorrent with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, o=None):
        self.xml = x = gtk.glade.XML(sibpath(__file__, "inspectro.glade"))
        self.tree_view = x.get_widget("treeview")
        colnames = ["Name", "Value"]
        for i in range(len(colnames)):
            self.tree_view.append_column(
                gtk.TreeViewColumn(
                colnames[i], gtk.CellRendererText(), text=i))
        d = {}
        for m in reflect.prefixedMethods(self, "on_"):
            d[m.im_func.__name__] = m
        self.xml.signal_autoconnect(d)
        if o is not None:
            self.inspect(o)
        self.ns = {'inspect': self.inspect}
        iwidget = x.get_widget('input')
        self.input = ConsoleInput(iwidget)
        self.input.toplevel = self
        iwidget.connect("key_press_event", self.input._on_key_press_event)
        self.output = ConsoleOutput(x.get_widget('output')) 
Example #11
Source File: show_last_packets.py    From 802.11ah-ns3 with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self):
            super(ShowLastPackets.PacketList, self).__init__()
            self.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
                                vscrollbar_policy=gtk.POLICY_AUTOMATIC)
            self.table_model = gtk.ListStore(*([str]*4))
            treeview = gtk.TreeView(self.table_model)
            treeview.show()
            self.add(treeview)

            def add_column(descr, colid):
                column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
                treeview.append_column(column)

            add_column("Time", self.COLUMN_TIME)
            add_column("Interface", self.COLUMN_INTERFACE)
            add_column("Size", self.COLUMN_SIZE)
            add_column("Contents", self.COLUMN_CONTENTS) 
Example #12
Source File: show_last_packets.py    From ns3-rdma with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self):
            super(ShowLastPackets.PacketList, self).__init__()
            self.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
                                vscrollbar_policy=gtk.POLICY_AUTOMATIC)
            self.table_model = gtk.ListStore(*([str]*4))
            treeview = gtk.TreeView(self.table_model)
            treeview.show()
            self.add(treeview)

            def add_column(descr, colid):
                column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
                treeview.append_column(column)

            add_column("Time", self.COLUMN_TIME)
            add_column("Interface", self.COLUMN_INTERFACE)
            add_column("Size", self.COLUMN_SIZE)
            add_column("Contents", self.COLUMN_CONTENTS) 
Example #13
Source File: _inspectro.py    From python-for-android with Apache License 2.0 6 votes vote down vote up
def __init__(self, o=None):
        self.xml = x = gtk.glade.XML(sibpath(__file__, "inspectro.glade"))
        self.tree_view = x.get_widget("treeview")
        colnames = ["Name", "Value"]
        for i in range(len(colnames)):
            self.tree_view.append_column(
                gtk.TreeViewColumn(
                colnames[i], gtk.CellRendererText(), text=i))
        d = {}
        for m in reflect.prefixedMethods(self, "on_"):
            d[m.im_func.__name__] = m
        self.xml.signal_autoconnect(d)
        if o is not None:
            self.inspect(o)
        self.ns = {'inspect': self.inspect}
        iwidget = x.get_widget('input')
        self.input = ConsoleInput(iwidget)
        self.input.toplevel = self
        iwidget.connect("key_press_event", self.input._on_key_press_event)
        self.output = ConsoleOutput(x.get_widget('output')) 
Example #14
Source File: show_last_packets.py    From CRE-NS3 with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self):
            super(ShowLastPackets.PacketList, self).__init__()
            self.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
                                vscrollbar_policy=gtk.POLICY_AUTOMATIC)
            self.table_model = gtk.ListStore(*([str]*4))
            treeview = gtk.TreeView(self.table_model)
            treeview.show()
            self.add(treeview)

            def add_column(descr, colid):
                column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
                treeview.append_column(column)

            add_column("Time", self.COLUMN_TIME)
            add_column("Interface", self.COLUMN_INTERFACE)
            add_column("Size", self.COLUMN_SIZE)
            add_column("Contents", self.COLUMN_CONTENTS) 
Example #15
Source File: util.py    From nightmare with GNU General Public License v2.0 6 votes vote down vote up
def makeColumn(name, index, onedit=None, cell=None, links=None):
    """
    Return a default "TreeViewColumn" of name "name"
    whose TreeModel index for the renderer is "index"
    """
    if cell == None:
        cell = gtk.CellRendererText()
    if links == None:
        links = {"text":index}
    if onedit:
        cell.set_property("editable", True)
        cell.connect("edited", onedit)
    col = gtk.TreeViewColumn(name,cell,**links)
    col.set_property("clickable", True)
    col.set_property("reorderable", True)
    col.set_property("resizable",True)
    col.set_property("sizing",1)
    col.set_property("sort-indicator", True)
    col.set_sort_column_id(index)
    return col 
Example #16
Source File: show_last_packets.py    From ns-3-dev-git with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self):
            super(ShowLastPackets.PacketList, self).__init__()
            self.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
                                vscrollbar_policy=gtk.POLICY_AUTOMATIC)
            self.table_model = gtk.ListStore(*([str]*4))
            treeview = gtk.TreeView(self.table_model)
            treeview.show()
            self.add(treeview)

            def add_column(descr, colid):
                column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
                treeview.append_column(column)

            add_column("Time", self.COLUMN_TIME)
            add_column("Interface", self.COLUMN_INTERFACE)
            add_column("Size", self.COLUMN_SIZE)
            add_column("Contents", self.COLUMN_CONTENTS) 
Example #17
Source File: show_last_packets.py    From ns3-ecn-sharp with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self):
            super(ShowLastPackets.PacketList, self).__init__()
            self.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
                                vscrollbar_policy=gtk.POLICY_AUTOMATIC)
            self.table_model = gtk.ListStore(*([str]*4))
            treeview = gtk.TreeView(self.table_model)
            treeview.show()
            self.add(treeview)

            def add_column(descr, colid):
                column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
                treeview.append_column(column)

            add_column("Time", self.COLUMN_TIME)
            add_column("Interface", self.COLUMN_INTERFACE)
            add_column("Size", self.COLUMN_SIZE)
            add_column("Contents", self.COLUMN_CONTENTS) 
Example #18
Source File: interface_statistics.py    From ns3-ecn-sharp with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, visualizer, node_index, statistics_collector):
        InformationWindow.__init__(self)
        self.win = gtk.Dialog(parent=visualizer.window,
                              flags=gtk.DIALOG_DESTROY_WITH_PARENT|gtk.DIALOG_NO_SEPARATOR,
                              buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
        self.win.connect("response", self._response_cb)
        self.win.set_title("Statistics for node %i" % node_index) 
        self.visualizer = visualizer
        self.statistics_collector = statistics_collector
        self.node_index = node_index
        self.viz_node = visualizer.get_node(node_index)

        self.table_model = gtk.ListStore(*([str]*13))

        treeview = gtk.TreeView(self.table_model)
        treeview.show()
        self.win.vbox.add(treeview)
        
        def add_column(descr, colid):
            column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
            treeview.append_column(column)
            
        add_column("Interface", self.COLUMN_INTERFACE)

        add_column("Tx Packets", self.COLUMN_TX_PACKETS)
        add_column("Tx Bytes", self.COLUMN_TX_BYTES)
        add_column("Tx pkt/1s", self.COLUMN_TX_PACKET_RATE)
        add_column("Tx bit/1s", self.COLUMN_TX_BIT_RATE)

        add_column("Rx Packets", self.COLUMN_RX_PACKETS)
        add_column("Rx Bytes", self.COLUMN_RX_BYTES)
        add_column("Rx pkt/1s", self.COLUMN_RX_PACKET_RATE)
        add_column("Rx bit/1s", self.COLUMN_RX_BIT_RATE)

        self.visualizer.add_information_window(self)
        self.win.show() 
Example #19
Source File: radmin.py    From rpy2 with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self):
        super(VignetteExplorer, self).__init__()
        self._table = gtk.ListStore(str, str, str)
        self.updateKnownVignettes()
        self._treeView = gtk.TreeView(model = self._table)
        self._treeView.show()
        self._valueColumns = [gtk.TreeViewColumn('Package'),
                              gtk.TreeViewColumn('Item'),
                              gtk.TreeViewColumn('Title')]
        self._valueCells = []
        for col_i, col in enumerate(self._valueColumns):
            self._treeView.append_column(col)
            cr = gtk.CellRendererText()
            col.pack_start(cr, True)
            self._valueCells.append(cr)
            col.set_attributes(cr, text=col_i)

        sbox = gtk.HBox(homogeneous=False, spacing=0)
        #sbox.show()
        sentry = gtk.Entry()
        sentry.show()
        sbox.add(sentry)
        sbutton = gtk.Button("Search")
        sbutton.show()
        sbox.add(sbutton)
        self.pack_start(sbox, expand=False, fill=False, padding=0)
        s_window = gtk.ScrolledWindow()
        s_window.set_policy(gtk.POLICY_AUTOMATIC, 
                            gtk.POLICY_AUTOMATIC)
        s_window.show()
        s_window.add(self._treeView)
        self.add(s_window)
        vbox = gtk.HBox(homogeneous=False, spacing=0)
        vbox.show()
        vbutton = gtk.Button("View")
        vbutton.connect("clicked", self.viewAction, "view")
        vbutton.show()
        vbox.add(vbutton)
        self.pack_start(vbox, expand=False, fill=False, padding=0) 
Example #20
Source File: gladereactor.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        self.xml = gtk.glade.XML(util.sibpath(__file__,"gladereactor.glade"))
        d = {}
        for m in reflect.prefixedMethods(self, "on_"):
            d[m.im_func.__name__] = m
        self.xml.signal_autoconnect(d)
        self.xml.get_widget('window1').connect('destroy',
                                               lambda w: self.stop())
        self.servers = self.xml.get_widget("servertree")
        sel = self.servers.get_selection()
        sel.set_mode(gtk.SELECTION_SINGLE)
        sel.connect("changed",
                    self.servers_selection_changed)
        ## argh coredump: self.servers_selection_changed(sel)
        self.xml.get_widget('suspend').set_sensitive(0)
        self.xml.get_widget('disconnect').set_sensitive(0)
        # setup model, connect it to my treeview
        self.model = gtk.ListStore(str, object, gobject.TYPE_BOOLEAN,
                                   gobject.TYPE_BOOLEAN)
        self.servers.set_model(self.model)
        self.servers.set_reorderable(1)
        self.servers.set_headers_clickable(1)
        # self.servers.set_headers_draggable(1)
        # add a column
        for col in [
            gtk.TreeViewColumn('Server',
                               gtk.CellRendererText(),
                               text=0),
            gtk.TreeViewColumn('Reading',
                               gtk.CellRendererToggle(),
                               active=2),
            gtk.TreeViewColumn('Writing',
                               gtk.CellRendererToggle(),
                               active=3)]:
            
            self.servers.append_column(col)
            col.set_resizable(1)
        sup.__init__(self) 
Example #21
Source File: inspect.py    From Emoji-Tools with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, fontfile):

		self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
		self.window.set_title("%s - pyftinspect" % fontfile)
		self.window.connect("delete_event", self._delete_event)
		self.window.set_size_request(400, 600)

		self.scrolled_window = gtk.ScrolledWindow()
		self.window.add(self.scrolled_window)

		self.font = ttLib.TTFont(fontfile, lazy=True)
		self.treemodel = FontTreeModel(self.font)
		self.treeview = gtk.TreeView(self.treemodel)
		#self.treeview.set_reorderable(True)

		for i in range(2):
			col_name = ('Key', 'Value')[i]
			col = gtk.TreeViewColumn(col_name)
			col.set_sort_column_id(-1)
			self.treeview.append_column(col)

			cell = gtk.CellRendererText()
			col.pack_start(cell, True)
			col.add_attribute(cell, 'text', i)

		self.treeview.set_search_column(1)
		self.scrolled_window.add(self.treeview)
		self.window.show_all() 
Example #22
Source File: entries.py    From gimp-plugin-export-layers with GNU General Public License v3.0 5 votes vote down vote up
def _add_columns(self):
    def _add_column(
          cell_renderer, cell_renderer_property, column_number, column_title=None):
      column = gtk.TreeViewColumn(
        column_title, cell_renderer, **{cell_renderer_property: column_number})
      self._popup.tree_view.append_column(column)
    
    self._cell_renderer_description = gtk.CellRendererText()
    self._cell_renderer_extensions = cellrenderers_.CellRendererTextList()
    _add_column(self._cell_renderer_description, "text", self._COLUMN_DESCRIPTION)
    _add_column(self._cell_renderer_extensions, "markup-list", self._COLUMN_EXTENSIONS) 
Example #23
Source File: entries.py    From gimp-plugin-export-layers with GNU General Public License v3.0 5 votes vote down vote up
def _add_columns(self):
    self._popup.tree_view.append_column(
      gtk.TreeViewColumn(None, gtk.CellRendererText(), text=self._COLUMN_ITEM_NAMES)) 
Example #24
Source File: interface_statistics.py    From Tocino with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, visualizer, node_index, statistics_collector):
        InformationWindow.__init__(self)
        self.win = gtk.Dialog(parent=visualizer.window,
                              flags=gtk.DIALOG_DESTROY_WITH_PARENT|gtk.DIALOG_NO_SEPARATOR,
                              buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
        self.win.connect("response", self._response_cb)
        self.win.set_title("Statistics for node %i" % node_index) 
        self.visualizer = visualizer
        self.statistics_collector = statistics_collector
        self.node_index = node_index
        self.viz_node = visualizer.get_node(node_index)

        self.table_model = gtk.ListStore(*([str]*13))

        treeview = gtk.TreeView(self.table_model)
        treeview.show()
        self.win.vbox.add(treeview)
        
        def add_column(descr, colid):
            column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
            treeview.append_column(column)
            
        add_column("Interface", self.COLUMN_INTERFACE)

        add_column("Tx Packets", self.COLUMN_TX_PACKETS)
        add_column("Tx Bytes", self.COLUMN_TX_BYTES)
        add_column("Tx pkt/1s", self.COLUMN_TX_PACKET_RATE)
        add_column("Tx bit/1s", self.COLUMN_TX_BIT_RATE)

        add_column("Rx Packets", self.COLUMN_RX_PACKETS)
        add_column("Rx Bytes", self.COLUMN_RX_BYTES)
        add_column("Rx pkt/1s", self.COLUMN_RX_PACKET_RATE)
        add_column("Rx bit/1s", self.COLUMN_RX_BIT_RATE)

        self.visualizer.add_information_window(self)
        self.win.show() 
Example #25
Source File: interface_statistics.py    From CRE-NS3 with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, visualizer, node_index, statistics_collector):
        InformationWindow.__init__(self)
        self.win = gtk.Dialog(parent=visualizer.window,
                              flags=gtk.DIALOG_DESTROY_WITH_PARENT|gtk.DIALOG_NO_SEPARATOR,
                              buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
        self.win.connect("response", self._response_cb)
        self.win.set_title("Statistics for node %i" % node_index) 
        self.visualizer = visualizer
        self.statistics_collector = statistics_collector
        self.node_index = node_index
        self.viz_node = visualizer.get_node(node_index)

        self.table_model = gtk.ListStore(*([str]*13))

        treeview = gtk.TreeView(self.table_model)
        treeview.show()
        self.win.vbox.add(treeview)
        
        def add_column(descr, colid):
            column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
            treeview.append_column(column)
            
        add_column("Interface", self.COLUMN_INTERFACE)

        add_column("Tx Packets", self.COLUMN_TX_PACKETS)
        add_column("Tx Bytes", self.COLUMN_TX_BYTES)
        add_column("Tx pkt/1s", self.COLUMN_TX_PACKET_RATE)
        add_column("Tx bit/1s", self.COLUMN_TX_BIT_RATE)

        add_column("Rx Packets", self.COLUMN_RX_PACKETS)
        add_column("Rx Bytes", self.COLUMN_RX_BYTES)
        add_column("Rx pkt/1s", self.COLUMN_RX_PACKET_RATE)
        add_column("Rx bit/1s", self.COLUMN_RX_BIT_RATE)

        self.visualizer.add_information_window(self)
        self.win.show() 
Example #26
Source File: gladereactor.py    From python-for-android with Apache License 2.0 5 votes vote down vote up
def __init__(self):
        self.xml = gtk.glade.XML(util.sibpath(__file__,"gladereactor.glade"))
        d = {}
        for m in reflect.prefixedMethods(self, "on_"):
            d[m.im_func.__name__] = m
        self.xml.signal_autoconnect(d)
        self.xml.get_widget('window1').connect('destroy',
                                               lambda w: self.stop())
        self.servers = self.xml.get_widget("servertree")
        sel = self.servers.get_selection()
        sel.set_mode(gtk.SELECTION_SINGLE)
        sel.connect("changed",
                    self.servers_selection_changed)
        ## argh coredump: self.servers_selection_changed(sel)
        self.xml.get_widget('suspend').set_sensitive(0)
        self.xml.get_widget('disconnect').set_sensitive(0)
        # setup model, connect it to my treeview
        self.model = gtk.ListStore(str, object, gobject.TYPE_BOOLEAN,
                                   gobject.TYPE_BOOLEAN)
        self.servers.set_model(self.model)
        self.servers.set_reorderable(1)
        self.servers.set_headers_clickable(1)
        # self.servers.set_headers_draggable(1)
        # add a column
        for col in [
            gtk.TreeViewColumn('Server',
                               gtk.CellRendererText(),
                               text=0),
            gtk.TreeViewColumn('Reading',
                               gtk.CellRendererToggle(),
                               active=2),
            gtk.TreeViewColumn('Writing',
                               gtk.CellRendererToggle(),
                               active=3)]:
            
            self.servers.append_column(col)
            col.set_resizable(1)
        sup.__init__(self) 
Example #27
Source File: _inspectro.py    From python-for-android with Apache License 2.0 5 votes vote down vote up
def __init__(self, p):
        self.p = p
        vals = [time.time()]
        if p.inLog:
            vals.append(p.inLog[0][0])
        if p.outLog:
            vals.append(p.outLog[0][0])
        self.startTime = min(vals)
        p.logViewer = self
        self.xml = x = gtk.glade.XML(sibpath(__file__, "logview.glade"))
        self.xml.signal_autoconnect(self)
        self.loglist = self.xml.get_widget("loglist")
        # setup model, connect it to my treeview
        self.model = gtk.ListStore(str, str, str)
        self.loglist.set_model(self.model)
        self.loglist.set_reorderable(1)
        self.loglist.set_headers_clickable(1)
        # self.servers.set_headers_draggable(1)
        # add a column
        for col in [
            gtk.TreeViewColumn('Time',
                               gtk.CellRendererText(),
                               text=0),
            gtk.TreeViewColumn('D',
                               gtk.CellRendererText(),
                               text=1),
            gtk.TreeViewColumn('Data',
                               gtk.CellRendererText(),
                               text=2)]:
            self.loglist.append_column(col)
            col.set_resizable(1)
        r = []
        for t, data in p.inLog:
            r.append(((str(t - self.startTime), "R", repr(data)[1:-1])))
        for t, data in p.outLog:
            r.append(((str(t - self.startTime), "S", repr(data)[1:-1])))
        r.sort()
        for i in r:
            self.model.append(i) 
Example #28
Source File: radmin.py    From rpy2 with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self):
        super(GraphicalDeviceExplorer, self).__init__()
        self._table = gtk.ListStore(str, int, str, str)
        self.updateOpenedDevices()
        self._treeView = gtk.TreeView(model = self._table)
        self._treeView.show()
        self._valueColumns = [gtk.TreeViewColumn('Active'),
                              gtk.TreeViewColumn('Number'),
                              gtk.TreeViewColumn('Device'),
                              gtk.TreeViewColumn('Title')]
        self._valueCells = []
        for col_i, col in enumerate(self._valueColumns):
            self._treeView.append_column(col)
            cr = gtk.CellRendererText()
            col.pack_start(cr, True)
            self._valueCells.append(cr)
            col.set_attributes(cr, text=col_i)

        sbox = gtk.HBox(homogeneous=False, spacing=0)
        sbox.show()
        sentry = gtk.Entry()
        sentry.show()
        sbox.add(sentry)
        sbutton = gtk.Button("Refresh")
        sbutton.connect("clicked", self.searchOpenedDevices, "search")
        sbutton.show()
        sbox.add(sbutton)
        self.pack_start(sbox, expand=False, fill=False, padding=0)
        s_window = gtk.ScrolledWindow()
        s_window.set_policy(gtk.POLICY_AUTOMATIC, 
                            gtk.POLICY_AUTOMATIC)
        s_window.show()
        s_window.add(self._treeView)
        self.add(s_window) 
Example #29
Source File: gnome_connection_manager.py    From gnome-connection-manager with GNU General Public License v3.0 5 votes vote down vote up
def initLeftPane(self):
        global groups       

        self.treeModel = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT, gtk.gdk.Pixbuf)
        self.treeServers.set_model(self.treeModel)

        self.treeServers.set_level_indentation(5)
        #Force the alternating row colors, by default it's off with one column
        self.treeServers.set_property('rules-hint', True)
        gtk.rc_parse_string( """
                style "custom-treestyle"{
                    GtkTreeView::allow-rules = 1
                }
                widget "*treeServers*" style "custom-treestyle"
            """)
        column = gtk.TreeViewColumn()
        column.set_title('Servers')
        self.treeServers.append_column( column )

        renderer = gtk.CellRendererPixbuf()
        column.pack_start(renderer, expand=False)
        column.add_attribute(renderer, 'pixbuf', 2)

        renderer = gtk.CellRendererText()
        column.pack_start(renderer, expand=True)
        column.add_attribute(renderer, 'text', 0)
        
        self.treeServers.set_has_tooltip(True)
        self.treeServers.connect('query-tooltip', self.on_treeServers_tooltip)
        self.loadConfig()
        self.updateTree() 
Example #30
Source File: _inspectro.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, p):
        self.p = p
        vals = [time.time()]
        if p.inLog:
            vals.append(p.inLog[0][0])
        if p.outLog:
            vals.append(p.outLog[0][0])
        self.startTime = min(vals)
        p.logViewer = self
        self.xml = x = gtk.glade.XML(sibpath(__file__, "logview.glade"))
        self.xml.signal_autoconnect(self)
        self.loglist = self.xml.get_widget("loglist")
        # setup model, connect it to my treeview
        self.model = gtk.ListStore(str, str, str)
        self.loglist.set_model(self.model)
        self.loglist.set_reorderable(1)
        self.loglist.set_headers_clickable(1)
        # self.servers.set_headers_draggable(1)
        # add a column
        for col in [
            gtk.TreeViewColumn('Time',
                               gtk.CellRendererText(),
                               text=0),
            gtk.TreeViewColumn('D',
                               gtk.CellRendererText(),
                               text=1),
            gtk.TreeViewColumn('Data',
                               gtk.CellRendererText(),
                               text=2)]:
            self.loglist.append_column(col)
            col.set_resizable(1)
        r = []
        for t, data in p.inLog:
            r.append(((str(t - self.startTime), "R", repr(data)[1:-1])))
        for t, data in p.outLog:
            r.append(((str(t - self.startTime), "S", repr(data)[1:-1])))
        r.sort()
        for i in r:
            self.model.append(i)