Python gtk.TreeView() Examples

The following are 30 code examples of gtk.TreeView(). 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 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 #2
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 #3
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 #4
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 #5
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 #6
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 #7
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 #8
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 #9
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 #10
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 #11
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 #12
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 #13
Source File: radmin.py    From rpy2 with GNU General Public License v2.0 6 votes vote down vote up
def viewAction(self, widget, data=None):
        # Get the selection in the gtk.TreeView
	selection = self._treeView.get_selection()
	# Get the selection iter
	model, selection_iter = selection.get_selected()
        if selection_iter:
            packName = self._table.get_value(selection_iter, 
                                             self.PACKAGE_I)
            vigName = self._table.get_value(selection_iter, 
                                            self.ITEM_I)
            
            pdffile = robjects.r.vignette(vigName, package = packName)
            pdffile = pdffile.subset("file")[0][0]
            pdfviewer = robjects.baseenv["options"]("pdfviewer")[0][0]

            pid = os.spawnl(os.P_NOWAIT, pdfviewer, pdffile) 
Example #14
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 #15
Source File: interface_statistics.py    From ntu-dsi-dcn 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 #16
Source File: entrypopup.py    From gimp-plugin-export-layers with GNU General Public License v3.0 5 votes vote down vote up
def _init_gui(self, column_types, rows):
    self._rows = gtk.ListStore(*column_types)
    
    for row in rows:
      self._rows.append(row)
    
    self._rows_filtered = self._rows.filter_new()
    
    self._tree_view = gtk.TreeView(model=self._rows_filtered)
    self._tree_view.set_hover_selection(True)
    self._tree_view.set_headers_visible(False)
    self._tree_view.set_enable_search(False)
    self._tree_view.set_size_request(self._width, self._height)
    
    self._scrolled_window = gtk.ScrolledWindow()
    self._scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
    self._scrolled_window.set_shadow_type(gtk.SHADOW_ETCHED_IN)
    self._scrolled_window.add(self._tree_view)
    
    # HACK: Make sure the height of the tree view can be set properly. Source:
    # https://github.com/GNOME/gtk/blob/gtk-2-24/gtk/gtkentrycompletion.c#L472
    self._scrolled_window.get_vscrollbar().set_size_request(-1, 0)
    
    # Using `gtk.WINDOW_POPUP` prevents the popup from stealing focus from the
    # text entry.
    self._popup = gtk.Window(type=gtk.WINDOW_POPUP)
    self._popup.set_resizable(False)
    self._popup.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_COMBO)
    self._popup.add(self._scrolled_window)
    
    self._scrolled_window.show_all() 
Example #17
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 #18
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 #19
Source File: radmin.py    From rpy2 with GNU General Public License v2.0 5 votes vote down vote up
def loadAction(self, widget, data=None):
        # Get the selection in the gtk.TreeView
	selection = self._treeView.get_selection()
	# Get the selection iter
	model, selection_iter = selection.get_selected()
        if selection_iter:
            packName = self._table.get_value(selection_iter, 
                                            self.PACKAGE_I)
            self._console.append('library("%s")\n' %packName)

            if sys.platform == 'win32':
                tfile = robjects.baseenv["tempfile"]()
                tmp = robjects.baseenv["file"](tfile, open="w")
            else:
                tmp = robjects.baseenv["fifo"]("")
            robjects.baseenv["sink"](tmp)
            
            robjects.baseenv["library"](packName)

            if sys.platform == 'win32':
                robjects.baseenv["close"](tmp)
                tmp = robjects.baseenv["file"](tfile, open="r")
            out = robjects.baseenv["readLines"](tmp)
            for line in out:
                self._console.append(str(line)+"\n")
            robjects.r.close(tmp)
            self._console.append("> ") 
Example #20
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 #21
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 #22
Source File: interface_statistics.py    From ns-3-dev-git 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 #23
Source File: radmin.py    From rpy2 with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, env):
        super(EnvExplorer, self).__init__()
        self._env = env
        self._table = gtk.ListStore(str, str)
        self.updateTable(None)
        self._treeView = gtk.TreeView(model = self._table)
        self._treeView.show()
        self._valueColumns = [gtk.TreeViewColumn('Symbol'),
                              gtk.TreeViewColumn('Type'),]
        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()
        slabel = gtk.Label("Search:")
        slabel.show()
        sbox.pack_start(slabel, True, True, 0)
        self.sentry = gtk.Entry()
        self.sentry.show()
        sbox.add(self.sentry)
        sbutton = gtk.Button("Refresh")
        sbutton.connect("clicked", self.searchAction, "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 #24
Source File: views.py    From nightmare with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self):
        VView.__init__(self)
        self.treeview = gtk.TreeView()
        self.treeview.connect("row_activated", self.vwActivated)
        cols = self.vwGetColumns()
        self.vwInitModel(cols, self.__model_class__)
        self.add(self.treeview)
        self.vwLoad() 
Example #25
Source File: interface_statistics.py    From ns3-load-balance 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: SourceReferences.py    From addons-source with GNU General Public License v2.0 5 votes vote down vote up
def build_gui(self):
        """
        Build the GUI interface.
        """
        top = gtk.TreeView()
        titles = [(_('Type'), 0, 100),
                  (_('Name'), 1, 100),
                  ('', 2, 1), #hidden column for the handle
                  ('', 3, 1)] #hidden column for non-localized object type
        self.model = ListModel(top, titles, event_func=self.cb_double_click)
        return top 
Example #27
Source File: interface_statistics.py    From ns3-rdma 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 #28
Source File: interface_statistics.py    From IEEE-802.11ah-ns-3 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 #29
Source File: gtktools.py    From pycopia with Apache License 2.0 5 votes vote down vote up
def __init__(self, items=()):
        gtk.Dialog.__init__(self)
        self.ret = None
        self._started = 0
        self.connect("destroy", self.quit)
        self.connect("delete_event", self.quit)
        self.set_geometry_hints(min_width=250, min_height=300)
        scrolled_win = gtk.ScrolledWindow()
        scrolled_win.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scrolled_win.show()
        self.vbox.pack_start(scrolled_win)
        #self.vbox.show()

        button = gtk.Button("Cancel")
        button.connect("clicked", self.cancel)
        button.set_flags(gtk.CAN_DEFAULT)
        self.action_area.pack_start(button)
        button.show()

        ls = gtk.ListStore(gobject.TYPE_STRING)
        for item in items:
            iter = ls.append()
            ls.set(iter, 0, item)

        lister = gtk.TreeView(ls)
        selection = lister.get_selection()
        selection.set_mode(gtk.SELECTION_BROWSE)
        selection.unselect_all()
        lister.set_search_column(0)
        scrolled_win.add_with_viewport(lister)

        column = gtk.TreeViewColumn('Keyword', gtk.CellRendererText(), text=0)
        lister.append_column(column)
        lister.set_headers_visible(False)
        lister.connect("row-activated", self.row_activated)
        lister.show() 
Example #30
Source File: interface_statistics.py    From 802.11ah-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()