Python gtk.POLICY_AUTOMATIC Examples

The following are 30 code examples of gtk.POLICY_AUTOMATIC(). 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 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 #2
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 #3
Source File: core.py    From ns3-rdma with GNU General Public License v2.0 6 votes vote down vote up
def _start_shell(self, dummy_button):
        if self.shell_window is not None:
            self.shell_window.present()
            return
        
        self.shell_window = gtk.Window()
        self.shell_window.set_size_request(750,550)
        self.shell_window.set_resizable(True)
        scrolled_window = gtk.ScrolledWindow()
        scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
        ipython = ipython_view.IPythonView()
        ipython.modify_font(pango.FontDescription(SHELL_FONT))
        ipython.set_wrap_mode(gtk.WRAP_CHAR)
        ipython.show()
        scrolled_window.add(ipython)
        scrolled_window.show()
        self.shell_window.add(scrolled_window)
        self.shell_window.show()
        self.shell_window.connect('destroy', self._on_shell_window_destroy)

        self._update_ipython_selected_node()
        __IPYTHON__.user_ns['viz'] = self 
Example #4
Source File: _gui_messages.py    From gimp-plugin-export-layers with GNU General Public License v3.0 6 votes vote down vote up
def _get_details_expander(details_text, details_label):
  expander = gtk.Expander()
  expander.set_use_markup(True)
  expander.set_label("<b>" + details_label + "</b>")
  
  scrolled_window = gtk.ScrolledWindow()
  scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
  scrolled_window.set_size_request(400, 200)
  scrolled_window.set_shadow_type(gtk.SHADOW_IN)
  
  exception_text_view = gtk.TextView()
  exception_text_view.set_editable(False)
  exception_text_view.set_wrap_mode(gtk.WRAP_WORD)
  exception_text_view.set_cursor_visible(False)
  exception_text_view.set_pixels_above_lines(1)
  exception_text_view.set_pixels_below_lines(1)
  exception_text_view.set_pixels_inside_wrap(0)
  exception_text_view.set_left_margin(5)
  exception_text_view.set_right_margin(5)
  exception_text_view.get_buffer().set_text(details_text)
  
  scrolled_window.add(exception_text_view)
  expander.add(scrolled_window)
  
  return expander 
Example #5
Source File: user_messenger.py    From deluge-FileBotTool with GNU General Public License v3.0 6 votes vote down vote up
def display_text(self, title, text, parent=None, modal=False):
        dialog = InfoDialog(title, None, parent, modal)
        text_view = gtk.TextView()
        text_view.get_buffer().set_text(text)
        text_view.set_editable(False)
        text_view.set_cursor_visible(False)
        text_view.show()
        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        sw.show()
        sw.add(text_view)
        detail_view = gtk.Frame()
        detail_view.set_shadow_type(gtk.SHADOW_IN)
        detail_view.add(sw)
        detail_view.set_border_width(6)
        dialog.vbox.add(detail_view)
        detail_view.show()
        text_view.set_size_request(485, 300)
        dialog.run_async()
        return 
Example #6
Source File: core.py    From royal-chaos with MIT License 6 votes vote down vote up
def _start_shell(self, dummy_button):
        if self.shell_window is not None:
            self.shell_window.present()
            return
        
        self.shell_window = gtk.Window()
        self.shell_window.set_size_request(750,550)
        self.shell_window.set_resizable(True)
        scrolled_window = gtk.ScrolledWindow()
        scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
        self.ipython = ipython_view.IPythonView()
        self.ipython.modify_font(pango.FontDescription(SHELL_FONT))
        self.ipython.set_wrap_mode(gtk.WRAP_CHAR)
        self.ipython.show()
        scrolled_window.add(self.ipython)
        scrolled_window.show()
        self.shell_window.add(scrolled_window)
        self.shell_window.show()
        self.shell_window.connect('destroy', self._on_shell_window_destroy)

        self._update_ipython_selected_node()
        self.ipython.updateNamespace({'viz': self}) 
Example #7
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 #8
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 #9
Source File: core.py    From ns-3-dev-git with GNU General Public License v2.0 6 votes vote down vote up
def _start_shell(self, dummy_button):
        if self.shell_window is not None:
            self.shell_window.present()
            return
        
        self.shell_window = gtk.Window()
        self.shell_window.set_size_request(750,550)
        self.shell_window.set_resizable(True)
        scrolled_window = gtk.ScrolledWindow()
        scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
        self.ipython = ipython_view.IPythonView()
        self.ipython.modify_font(pango.FontDescription(SHELL_FONT))
        self.ipython.set_wrap_mode(gtk.WRAP_CHAR)
        self.ipython.show()
        scrolled_window.add(self.ipython)
        scrolled_window.show()
        self.shell_window.add(scrolled_window)
        self.shell_window.show()
        self.shell_window.connect('destroy', self._on_shell_window_destroy)

        self._update_ipython_selected_node()
        self.ipython.updateNamespace({'viz': self}) 
Example #10
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 #11
Source File: core.py    From CRE-NS3 with GNU General Public License v2.0 6 votes vote down vote up
def _start_shell(self, dummy_button):
        if self.shell_window is not None:
            self.shell_window.present()
            return
        
        self.shell_window = gtk.Window()
        self.shell_window.set_size_request(750,550)
        self.shell_window.set_resizable(True)
        scrolled_window = gtk.ScrolledWindow()
        scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
        ipython = ipython_view.IPythonView()
        ipython.modify_font(pango.FontDescription(SHELL_FONT))
        ipython.set_wrap_mode(gtk.WRAP_CHAR)
        ipython.show()
        scrolled_window.add(ipython)
        scrolled_window.show()
        self.shell_window.add(scrolled_window)
        self.shell_window.show()
        self.shell_window.connect('destroy', self._on_shell_window_destroy)

        self._update_ipython_selected_node()
        __IPYTHON__.user_ns['viz'] = self 
Example #12
Source File: core.py    From Tocino with GNU General Public License v2.0 6 votes vote down vote up
def _start_shell(self, dummy_button):
        if self.shell_window is not None:
            self.shell_window.present()
            return
        
        self.shell_window = gtk.Window()
        self.shell_window.set_size_request(750,550)
        self.shell_window.set_resizable(True)
        scrolled_window = gtk.ScrolledWindow()
        scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
        self.ipython = ipython_view.IPythonView()
        self.ipython.modify_font(pango.FontDescription(SHELL_FONT))
        self.ipython.set_wrap_mode(gtk.WRAP_CHAR)
        self.ipython.show()
        scrolled_window.add(self.ipython)
        scrolled_window.show()
        self.shell_window.add(scrolled_window)
        self.shell_window.show()
        self.shell_window.connect('destroy', self._on_shell_window_destroy)

        self._update_ipython_selected_node()
        self.ipython.updateNamespace({'viz': self}) 
Example #13
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 #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: core.py    From ns3-ecn-sharp with GNU General Public License v2.0 6 votes vote down vote up
def _start_shell(self, dummy_button):
        if self.shell_window is not None:
            self.shell_window.present()
            return
        
        self.shell_window = gtk.Window()
        self.shell_window.set_size_request(750,550)
        self.shell_window.set_resizable(True)
        scrolled_window = gtk.ScrolledWindow()
        scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
        self.ipython = ipython_view.IPythonView()
        self.ipython.modify_font(pango.FontDescription(SHELL_FONT))
        self.ipython.set_wrap_mode(gtk.WRAP_CHAR)
        self.ipython.show()
        scrolled_window.add(self.ipython)
        scrolled_window.show()
        self.shell_window.add(scrolled_window)
        self.shell_window.show()
        self.shell_window.connect('destroy', self._on_shell_window_destroy)

        self._update_ipython_selected_node()
        self.ipython.updateNamespace({'viz': self}) 
Example #16
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 #17
Source File: core.py    From ns3-802.11ad with GNU General Public License v2.0 6 votes vote down vote up
def _start_shell(self, dummy_button):
        if self.shell_window is not None:
            self.shell_window.present()
            return
        
        self.shell_window = gtk.Window()
        self.shell_window.set_size_request(750,550)
        self.shell_window.set_resizable(True)
        scrolled_window = gtk.ScrolledWindow()
        scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
        self.ipython = ipython_view.IPythonView()
        self.ipython.modify_font(pango.FontDescription(SHELL_FONT))
        self.ipython.set_wrap_mode(gtk.WRAP_CHAR)
        self.ipython.show()
        scrolled_window.add(self.ipython)
        scrolled_window.show()
        self.shell_window.add(scrolled_window)
        self.shell_window.show()
        self.shell_window.connect('destroy', self._on_shell_window_destroy)

        self._update_ipython_selected_node()
        self.ipython.updateNamespace({'viz': self}) 
Example #18
Source File: itembox.py    From gimp-plugin-export-layers with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, item_spacing=ITEM_SPACING, *args, **kwargs):
    super().__init__(*args, **kwargs)
    
    self._item_spacing = item_spacing
    
    self._drag_and_drop_context = draganddropcontext_.DragAndDropContext()
    self._items = []
    
    self._vbox_items = gtk.VBox(homogeneous=False)
    self._vbox_items.set_spacing(self._item_spacing)
    
    self._vbox = gtk.VBox(homogeneous=False)
    self._vbox.set_spacing(self.VBOX_SPACING)
    self._vbox.pack_start(self._vbox_items, expand=False, fill=False)
    
    self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
    self.add_with_viewport(self._vbox)
    self.get_child().set_shadow_type(gtk.SHADOW_NONE) 
Example #19
Source File: core.py    From 802.11ah-ns3 with GNU General Public License v2.0 6 votes vote down vote up
def _start_shell(self, dummy_button):
        if self.shell_window is not None:
            self.shell_window.present()
            return
        
        self.shell_window = gtk.Window()
        self.shell_window.set_size_request(750,550)
        self.shell_window.set_resizable(True)
        scrolled_window = gtk.ScrolledWindow()
        scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
        self.ipython = ipython_view.IPythonView()
        self.ipython.modify_font(pango.FontDescription(SHELL_FONT))
        self.ipython.set_wrap_mode(gtk.WRAP_CHAR)
        self.ipython.show()
        scrolled_window.add(self.ipython)
        scrolled_window.show()
        self.shell_window.add(scrolled_window)
        self.shell_window.show()
        self.shell_window.connect('destroy', self._on_shell_window_destroy)

        self._update_ipython_selected_node()
        self.ipython.updateNamespace({'viz': self}) 
Example #20
Source File: core.py    From ntu-dsi-dcn with GNU General Public License v2.0 6 votes vote down vote up
def _start_shell(self, dummy_button):
        if self.shell_window is not None:
            self.shell_window.present()
            return
        
        self.shell_window = gtk.Window()
        self.shell_window.set_size_request(750,550)
        self.shell_window.set_resizable(True)
        scrolled_window = gtk.ScrolledWindow()
        scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
        ipython = ipython_view.IPythonView()
        ipython.modify_font(pango.FontDescription(SHELL_FONT))
        ipython.set_wrap_mode(gtk.WRAP_CHAR)
        ipython.show()
        scrolled_window.add(ipython)
        scrolled_window.show()
        self.shell_window.add(scrolled_window)
        self.shell_window.show()
        self.shell_window.connect('destroy', self._on_shell_window_destroy)

        self._update_ipython_selected_node()
        __IPYTHON__.user_ns['viz'] = self 
Example #21
Source File: radmin.py    From rpy2 with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self):
        super(CodePanel, self).__init__()
        label = gtk.Label("Enter R code to evaluate")
        label.show()
        self.pack_start(label, False, True, 0)
        s_window = gtk.ScrolledWindow()
        s_window.set_policy(gtk.POLICY_AUTOMATIC, 
                            gtk.POLICY_AUTOMATIC)
        s_window.show()
        self._rpad = gtk.TextView(buffer=None)
        self._rpad.set_editable(True)
        self._rpad.show()
        s_window.add(self._rpad)
        self.add(s_window)
        evalButton = gtk.Button("Evaluate highlighted code")
        evalButton.connect("clicked", self.evaluateAction, "evaluate")
        evalButton.show()
        self.pack_start(evalButton, False, False, 0)
        self._evalButton = evalButton 
Example #22
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 #23
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 #24
Source File: core.py    From IEEE-802.11ah-ns-3 with GNU General Public License v2.0 6 votes vote down vote up
def _start_shell(self, dummy_button):
        if self.shell_window is not None:
            self.shell_window.present()
            return
        
        self.shell_window = gtk.Window()
        self.shell_window.set_size_request(750,550)
        self.shell_window.set_resizable(True)
        scrolled_window = gtk.ScrolledWindow()
        scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
        self.ipython = ipython_view.IPythonView()
        self.ipython.modify_font(pango.FontDescription(SHELL_FONT))
        self.ipython.set_wrap_mode(gtk.WRAP_CHAR)
        self.ipython.show()
        scrolled_window.add(self.ipython)
        scrolled_window.show()
        self.shell_window.add(scrolled_window)
        self.shell_window.show()
        self.shell_window.connect('destroy', self._on_shell_window_destroy)

        self._update_ipython_selected_node()
        self.ipython.updateNamespace({'viz': self}) 
Example #25
Source File: core.py    From ns3-load-balance with GNU General Public License v2.0 6 votes vote down vote up
def _start_shell(self, dummy_button):
        if self.shell_window is not None:
            self.shell_window.present()
            return
        
        self.shell_window = gtk.Window()
        self.shell_window.set_size_request(750,550)
        self.shell_window.set_resizable(True)
        scrolled_window = gtk.ScrolledWindow()
        scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
        self.ipython = ipython_view.IPythonView()
        self.ipython.modify_font(pango.FontDescription(SHELL_FONT))
        self.ipython.set_wrap_mode(gtk.WRAP_CHAR)
        self.ipython.show()
        scrolled_window.add(self.ipython)
        scrolled_window.show()
        self.shell_window.add(scrolled_window)
        self.shell_window.show()
        self.shell_window.connect('destroy', self._on_shell_window_destroy)

        self._update_ipython_selected_node()
        self.ipython.updateNamespace({'viz': self}) 
Example #26
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 #27
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 #28
Source File: views.py    From nightmare with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, closable=True):
        gtk.ScrolledWindow.__init__(self)
        self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.vwactive = True
        self.vwname = None
        self.closable = closable
        self.connect("destroy", self.vwDestroy) 
Example #29
Source File: gtkutil.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def scrollify(widget):
    #widget.set_word_wrap(gtk.TRUE)
    scrl=gtk.GtkScrolledWindow()
    scrl.add(widget)
    scrl.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
    # scrl.set_update_policy(gtk.POLICY_AUTOMATIC)
    return scrl 
Example #30
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)