Python gtk.DIALOG_DESTROY_WITH_PARENT Examples
The following are 30
code examples of gtk.DIALOG_DESTROY_WITH_PARENT().
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: gtk2util.py From BitTorrent with GNU General Public License v3.0 | 6 votes |
def _ebFailedLogin(self, reason): if isinstance(reason, failure.Failure): reason = reason.value self.statusMsg(reason) if isinstance(reason, (unicode, str)): text = reason else: text = unicode(reason) msg = gtk.MessageDialog(self._loginDialog, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, text) msg.show_all() msg.connect("response", lambda *a: msg.destroy()) # hostname not found # host unreachable # connection refused # authentication failed # no such service # no such perspective # internal server error
Example #2
Source File: gtk2util.py From python-for-android with Apache License 2.0 | 6 votes |
def _ebFailedLogin(self, reason): if isinstance(reason, failure.Failure): reason = reason.value self.statusMsg(reason) if isinstance(reason, (unicode, str)): text = reason else: text = unicode(reason) msg = gtk.MessageDialog(self._loginDialog, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, text) msg.show_all() msg.connect("response", lambda *a: msg.destroy()) # hostname not found # host unreachable # connection refused # authentication failed # no such service # no such perspective # internal server error
Example #3
Source File: interface_statistics.py From CRE-NS3 with GNU General Public License v2.0 | 5 votes |
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 #4
Source File: interface_statistics.py From ns3-rdma with GNU General Public License v2.0 | 5 votes |
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 #5
Source File: interface_statistics.py From ns3-ecn-sharp with GNU General Public License v2.0 | 5 votes |
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 #6
Source File: interface_statistics.py From 802.11ah-ns3 with GNU General Public License v2.0 | 5 votes |
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 #7
Source File: interface_statistics.py From ns3-load-balance with GNU General Public License v2.0 | 5 votes |
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 #8
Source File: SurnameMappingGramplet.py From addons-source with GNU General Public License v2.0 | 5 votes |
def show_dialog(self, title, surname, group): labelSurname = gtk.Label(_("Surname")) entrySurname = gtk.Entry() if surname: entrySurname.set_text(surname) labelGroup = gtk.Label(_("Group")) entryGroup = gtk.Entry() if group: entryGroup.set_text(group) dialog = gtk.Dialog(title, None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) table = gtk.Table(2, 2) table.attach(labelSurname, 0, 1, 0, 1, xoptions=gtk.SHRINK, yoptions=gtk.EXPAND, xpadding=5, ypadding=5) table.attach(labelGroup, 0, 1, 1, 2, xoptions=gtk.SHRINK, yoptions=gtk.EXPAND, xpadding=5, ypadding=5) table.attach(entrySurname, 1, 2, 0, 1, xoptions=gtk.FILL, yoptions=gtk.EXPAND, xpadding=5, ypadding=5) table.attach(entryGroup, 1, 2, 1, 2, xoptions=gtk.FILL, yoptions=gtk.EXPAND, xpadding=5, ypadding=5) dialog.vbox.pack_start(table, fill=True, expand=True) dialog.show_all() response = dialog.run() if response == gtk.RESPONSE_ACCEPT: result = (entrySurname.get_text(), entryGroup.get_text()) else: result = None dialog.destroy() return result
Example #9
Source File: interface_statistics.py From Tocino with GNU General Public License v2.0 | 5 votes |
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 #10
Source File: interface_statistics.py From IEEE-802.11ah-ns-3 with GNU General Public License v2.0 | 5 votes |
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 #11
Source File: interface_statistics.py From ns-3-dev-git with GNU General Public License v2.0 | 5 votes |
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 #12
Source File: main.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 5 votes |
def display_reset_prompt(parent=None, more_settings_shown=False): dialog = gtk.MessageDialog( parent=parent, type=gtk.MESSAGE_WARNING, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, buttons=gtk.BUTTONS_YES_NO) dialog.set_transient_for(parent) dialog.set_title(pg.config.PLUGIN_TITLE) dialog.set_markup( gobject.markup_escape_text(_("Are you sure you want to reset settings?"))) if more_settings_shown: checkbutton_reset_operations = gtk.CheckButton( label=_("Remove procedures and constraints"), use_underline=False) dialog.vbox.pack_start(checkbutton_reset_operations, expand=False, fill=False) dialog.set_focus(dialog.get_widget_for_response(gtk.RESPONSE_NO)) dialog.show_all() response_id = dialog.run() dialog.destroy() clear_operations = ( checkbutton_reset_operations.get_active() if more_settings_shown else False) return response_id, clear_operations
Example #13
Source File: interface_statistics.py From ntu-dsi-dcn with GNU General Public License v2.0 | 5 votes |
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 #14
Source File: step_editor.py From avocado-vt with GNU General Public License v2.0 | 5 votes |
def message(self, text, title): dlg = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, title) dlg.set_title(title) dlg.format_secondary_text(text) dlg.run() dlg.destroy()
Example #15
Source File: step_editor.py From avocado-vt with GNU General Public License v2.0 | 5 votes |
def inputdialog(self, text, title, default_response=""): # Define a little helper function def inputdialog_entry_activated(entry): dlg.response(gtk.RESPONSE_OK) # Create the dialog dlg = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_OK_CANCEL, title) dlg.set_title(title) dlg.format_secondary_text(text) # Create an entry widget entry = gtk.Entry() entry.set_text(default_response) entry.connect("activate", inputdialog_entry_activated) dlg.vbox.pack_start(entry) entry.show() # Run the dialog response = dlg.run() dlg.destroy() if response == gtk.RESPONSE_OK: return entry.get_text() return None
Example #16
Source File: step_editor.py From avocado-vt with GNU General Public License v2.0 | 5 votes |
def question_yes_no(self, text, title): dlg = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, title) dlg.set_title(title) dlg.format_secondary_text(text) response = dlg.run() dlg.destroy() if response == gtk.RESPONSE_YES: return True return False
Example #17
Source File: core.py From CRE-NS3 with GNU General Public License v2.0 | 4 votes |
def _take_screenshot(self, dummy_button): #print "Cheese!" file_name = self._get_export_file_name() if file_name is None: return # figure out the correct bounding box for what is visible on screen x1 = self._scrolled_window.get_hadjustment().value y1 = self._scrolled_window.get_vadjustment().value x2 = x1 + self._scrolled_window.get_hadjustment().page_size y2 = y1 + self._scrolled_window.get_vadjustment().page_size bounds = goocanvas.Bounds() bounds.x1, bounds.y1 = self.canvas.convert_from_pixels(x1, y1) bounds.x2, bounds.y2 = self.canvas.convert_from_pixels(x2, y2) dest_width = bounds.x2 - bounds.x1 dest_height = bounds.y2 - bounds.y1 #print bounds.x1, bounds.y1, " -> ", bounds.x2, bounds.y2 dummy, extension = os.path.splitext(file_name) extension = extension.lower() if extension == '.eps': surface = cairo.PSSurface(file_name, dest_width, dest_height) elif extension == '.pdf': surface = cairo.PDFSurface(file_name, dest_width, dest_height) elif extension == '.svg': surface = cairo.SVGSurface(file_name, dest_width, dest_height) else: dialog = gtk.MessageDialog(parent = self.canvas.get_toplevel(), flags = gtk.DIALOG_DESTROY_WITH_PARENT, type = gtk.MESSAGE_ERROR, buttons = gtk.BUTTONS_OK, message_format = "Unknown extension '%s' (valid extensions are '.eps', '.svg', and '.pdf')" % (extension,)) dialog.run() dialog.destroy() return # draw the canvas to a printing context cr = cairo.Context(surface) cr.translate(-bounds.x1, -bounds.y1) self.canvas.render(cr, bounds, self.zoom.value) cr.show_page() surface.finish()
Example #18
Source File: olsr.py From CRE-NS3 with GNU General Public License v2.0 | 4 votes |
def __init__(self, visualizer, node_index): 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.set_default_size(gtk.gdk.screen_width()/2, gtk.gdk.screen_height()/2) self.win.connect("response", self._response_cb) self.win.set_title("OLSR routing table for node %i" % node_index) self.visualizer = visualizer self.node_index = node_index self.table_model = gtk.ListStore(str, str, str, int) treeview = gtk.TreeView(self.table_model) treeview.show() sw = gtk.ScrolledWindow() sw.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC, vscrollbar_policy=gtk.POLICY_AUTOMATIC) sw.show() sw.add(treeview) self.win.vbox.add(sw) # Dest. column = gtk.TreeViewColumn('Destination', gtk.CellRendererText(), text=self.COLUMN_DESTINATION) treeview.append_column(column) # Next hop column = gtk.TreeViewColumn('Next hop', gtk.CellRendererText(), text=self.COLUMN_NEXT_HOP) treeview.append_column(column) # Interface column = gtk.TreeViewColumn('Interface', gtk.CellRendererText(), text=self.COLUMN_INTERFACE) treeview.append_column(column) # Num. Hops column = gtk.TreeViewColumn('Num. Hops', gtk.CellRendererText(), text=self.COLUMN_NUM_HOPS) treeview.append_column(column) self.visualizer.add_information_window(self) self.win.show()
Example #19
Source File: overwritechooser.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 4 votes |
def _init_gui(self): self._dialog = gimpui.Dialog( title="", role=None, parent=self._parent, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT) self._dialog.set_transient_for(self._parent) self._dialog.set_title(self._title) self._dialog.set_border_width(self._DIALOG_BORDER_WIDTH) self._dialog.set_resizable(False) self._dialog_icon = gtk.Image() self._dialog_icon.set_from_stock(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_DIALOG) self._dialog_text = gtk.Label("") self._dialog_text.set_line_wrap(True) self._dialog_text.set_use_markup(True) self._dialog_text_event_box = gtk.EventBox() self._dialog_text_event_box.add(self._dialog_text) self._hbox_dialog_contents = gtk.HBox(homogeneous=False) self._hbox_dialog_contents.set_spacing(self._DIALOG_HBOX_CONTENTS_SPACING) self._hbox_dialog_contents.pack_start(self._dialog_icon, expand=False, fill=False) self._hbox_dialog_contents.pack_start( self._dialog_text_event_box, expand=False, fill=False) self._checkbutton_apply_to_all = gtk.CheckButton( label=_("_Apply action to all files")) self._checkbutton_apply_to_all.set_use_underline(True) self._dialog.vbox.set_spacing(self._DIALOG_VBOX_SPACING) self._dialog.vbox.pack_start(self._hbox_dialog_contents, expand=False, fill=False) self._dialog.vbox.pack_start(self._checkbutton_apply_to_all, expand=False, fill=False) self._buttons = {} for value, display_name in self.values_and_display_names: self._buttons[value] = self._dialog.add_button(display_name, value) self._dialog.action_area.set_spacing(self._DIALOG_ACTION_AREA_SPACING) self._checkbutton_apply_to_all.connect( "toggled", self._on_checkbutton_apply_to_all_toggled) self._is_dialog_text_allocated_size = False self._dialog_text_event_box.connect( "size-allocate", self._on_dialog_text_event_box_size_allocate) self._dialog.set_focus(self._buttons[self.default_value])
Example #20
Source File: ipv4_routing_table.py From CRE-NS3 with GNU General Public License v2.0 | 4 votes |
def __init__(self, visualizer, node_index): 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("IPv4 routing table for node %i" % node_index) self.visualizer = visualizer self.node_index = node_index self.table_model = gtk.ListStore(str, str, str, str, int) treeview = gtk.TreeView(self.table_model) treeview.show() sw = gtk.ScrolledWindow() sw.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC, vscrollbar_policy=gtk.POLICY_AUTOMATIC) sw.show() sw.add(treeview) self.win.vbox.add(sw) self.win.set_default_size(600, 300) # Dest. column = gtk.TreeViewColumn('Destination', gtk.CellRendererText(), text=self.COLUMN_DESTINATION) treeview.append_column(column) # Next hop column = gtk.TreeViewColumn('Next hop', gtk.CellRendererText(), text=self.COLUMN_NEXT_HOP) treeview.append_column(column) # Interface column = gtk.TreeViewColumn('Interface', gtk.CellRendererText(), text=self.COLUMN_INTERFACE) treeview.append_column(column) # Type column = gtk.TreeViewColumn('Type', gtk.CellRendererText(), text=self.COLUMN_TYPE) treeview.append_column(column) # Prio column = gtk.TreeViewColumn('Prio', gtk.CellRendererText(), text=self.COLUMN_PRIO) treeview.append_column(column) self.visualizer.add_information_window(self) self.win.show()
Example #21
Source File: core.py From ns3-ecn-sharp with GNU General Public License v2.0 | 4 votes |
def _take_screenshot(self, dummy_button): #print "Cheese!" file_name = self._get_export_file_name() if file_name is None: return # figure out the correct bounding box for what is visible on screen x1 = self._scrolled_window.get_hadjustment().value y1 = self._scrolled_window.get_vadjustment().value x2 = x1 + self._scrolled_window.get_hadjustment().page_size y2 = y1 + self._scrolled_window.get_vadjustment().page_size bounds = goocanvas.Bounds() bounds.x1, bounds.y1 = self.canvas.convert_from_pixels(x1, y1) bounds.x2, bounds.y2 = self.canvas.convert_from_pixels(x2, y2) dest_width = bounds.x2 - bounds.x1 dest_height = bounds.y2 - bounds.y1 #print bounds.x1, bounds.y1, " -> ", bounds.x2, bounds.y2 dummy, extension = os.path.splitext(file_name) extension = extension.lower() if extension == '.eps': surface = cairo.PSSurface(file_name, dest_width, dest_height) elif extension == '.pdf': surface = cairo.PDFSurface(file_name, dest_width, dest_height) elif extension == '.svg': surface = cairo.SVGSurface(file_name, dest_width, dest_height) else: dialog = gtk.MessageDialog(parent = self.canvas.get_toplevel(), flags = gtk.DIALOG_DESTROY_WITH_PARENT, type = gtk.MESSAGE_ERROR, buttons = gtk.BUTTONS_OK, message_format = "Unknown extension '%s' (valid extensions are '.eps', '.svg', and '.pdf')" % (extension,)) dialog.run() dialog.destroy() return # draw the canvas to a printing context cr = cairo.Context(surface) cr.translate(-bounds.x1, -bounds.y1) self.canvas.render(cr, bounds, self.zoom.value) cr.show_page() surface.finish()
Example #22
Source File: olsr.py From ns3-ecn-sharp with GNU General Public License v2.0 | 4 votes |
def __init__(self, visualizer, node_index): 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.set_default_size(gtk.gdk.screen_width()/2, gtk.gdk.screen_height()/2) self.win.connect("response", self._response_cb) self.win.set_title("OLSR routing table for node %i" % node_index) self.visualizer = visualizer self.node_index = node_index self.table_model = gtk.ListStore(str, str, str, int) treeview = gtk.TreeView(self.table_model) treeview.show() sw = gtk.ScrolledWindow() sw.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC, vscrollbar_policy=gtk.POLICY_AUTOMATIC) sw.show() sw.add(treeview) self.win.vbox.add(sw) # Dest. column = gtk.TreeViewColumn('Destination', gtk.CellRendererText(), text=self.COLUMN_DESTINATION) treeview.append_column(column) # Next hop column = gtk.TreeViewColumn('Next hop', gtk.CellRendererText(), text=self.COLUMN_NEXT_HOP) treeview.append_column(column) # Interface column = gtk.TreeViewColumn('Interface', gtk.CellRendererText(), text=self.COLUMN_INTERFACE) treeview.append_column(column) # Num. Hops column = gtk.TreeViewColumn('Num. Hops', gtk.CellRendererText(), text=self.COLUMN_NUM_HOPS) treeview.append_column(column) self.visualizer.add_information_window(self) self.win.show()
Example #23
Source File: ipv4_routing_table.py From ns3-ecn-sharp with GNU General Public License v2.0 | 4 votes |
def __init__(self, visualizer, node_index): 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("IPv4 routing table for node %i" % node_index) self.visualizer = visualizer self.node_index = node_index self.table_model = gtk.ListStore(str, str, str, str, int) treeview = gtk.TreeView(self.table_model) treeview.show() sw = gtk.ScrolledWindow() sw.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC, vscrollbar_policy=gtk.POLICY_AUTOMATIC) sw.show() sw.add(treeview) self.win.vbox.add(sw) self.win.set_default_size(600, 300) # Dest. column = gtk.TreeViewColumn('Destination', gtk.CellRendererText(), text=self.COLUMN_DESTINATION) treeview.append_column(column) # Next hop column = gtk.TreeViewColumn('Next hop', gtk.CellRendererText(), text=self.COLUMN_NEXT_HOP) treeview.append_column(column) # Interface column = gtk.TreeViewColumn('Interface', gtk.CellRendererText(), text=self.COLUMN_INTERFACE) treeview.append_column(column) # Type column = gtk.TreeViewColumn('Type', gtk.CellRendererText(), text=self.COLUMN_TYPE) treeview.append_column(column) # Prio column = gtk.TreeViewColumn('Prio', gtk.CellRendererText(), text=self.COLUMN_PRIO) treeview.append_column(column) self.visualizer.add_information_window(self) self.win.show()
Example #24
Source File: data_model_tree.py From cellblender with GNU General Public License v2.0 | 4 votes |
def row_selected ( self, tv, path, col ): selected = tv.get_selection().get_selected() print ( "Row selected type: " + str(type(selected)) ) if type(selected) == type((1,2)): sel_val = selected[0].get_value(selected[1],0) if '=' in sel_val: dm_key = sel_val.split("=")[0].strip() dm_val = sel_val.split("=")[1].strip() sel_path = selected[0].get_path(selected[1]) print ( "selected = " + str(selected)) print ( "get_value(): " + str(sel_val) ) print ( "type(get_value()): " + str(type(sel_val)) ) print ( "get_path(): " + str(selected[0].get_path(selected[1])) ) #__import__('code').interact(local={k: v for ns in (globals(), locals()) for k, v in ns.items()}) #dialog = gtk.MessageDialog ( type=gtk.MESSAGE_QUESTION, buttons=gtk.BUTTONS_OK_CANCEL, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT ) #dialog.set_markup ( "Enter the <b>new value</b>" ) #response = dialog.run() #print ( "Dialog options = " + str(dir(dialog)) ) #print ( "Dialog action = " + str(dialog.get_action()) ) #print ( "Dialog response = " + str(response) ) #dialog = gtk.MessageDialog ( type=gtk.MESSAGE_QUESTION, buttons=gtk.BUTTONS_OK_CANCEL, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT ) dialog = gtk.MessageDialog ( type=gtk.MESSAGE_QUESTION, buttons=gtk.BUTTONS_OK, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT ) dialog.set_markup ( "Enter the new value for <b>" + dm_key + "</b>" ) #create the text input field #dm_key_field = gtk.Entry() dm_val_field = gtk.Entry() #dm_key_field.set_text ( dm_key ) dm_val_field.set_text ( dm_val ) #allow the user to press enter to do ok dm_val_field.connect("activate", responseToOKDialog, dialog, gtk.RESPONSE_OK) #create a horizontal box to pack the dm_key_field and a label hbox = gtk.HBox() hbox.pack_start(gtk.Label(dm_key + " = "), False, 5, 5) #hbox.pack_start(dm_key_field) #hbox.pack_start(gtk.Label(" = "), False, 5, 5) hbox.pack_end(dm_val_field) #some secondary text dialog.format_secondary_markup("Current value = <i>" + dm_val + "</i>") #add it and show it dialog.vbox.pack_end(hbox, True, True, 0) dialog.show_all() #go go go dialog.run() new_assignment = dm_key + " = " + dm_val_field.get_text() print ( "Got: " + new_assignment ) dialog.destroy() #selected[0].set_value( selected[1], 0, "(" + sel_val + ")" ) selected[0].set_value( selected[1], 0, new_assignment )
Example #25
Source File: core.py From ns3-802.11ad with GNU General Public License v2.0 | 4 votes |
def _take_screenshot(self, dummy_button): #print "Cheese!" file_name = self._get_export_file_name() if file_name is None: return # figure out the correct bounding box for what is visible on screen x1 = self._scrolled_window.get_hadjustment().value y1 = self._scrolled_window.get_vadjustment().value x2 = x1 + self._scrolled_window.get_hadjustment().page_size y2 = y1 + self._scrolled_window.get_vadjustment().page_size bounds = goocanvas.Bounds() bounds.x1, bounds.y1 = self.canvas.convert_from_pixels(x1, y1) bounds.x2, bounds.y2 = self.canvas.convert_from_pixels(x2, y2) dest_width = bounds.x2 - bounds.x1 dest_height = bounds.y2 - bounds.y1 #print bounds.x1, bounds.y1, " -> ", bounds.x2, bounds.y2 dummy, extension = os.path.splitext(file_name) extension = extension.lower() if extension == '.eps': surface = cairo.PSSurface(file_name, dest_width, dest_height) elif extension == '.pdf': surface = cairo.PDFSurface(file_name, dest_width, dest_height) elif extension == '.svg': surface = cairo.SVGSurface(file_name, dest_width, dest_height) else: dialog = gtk.MessageDialog(parent = self.canvas.get_toplevel(), flags = gtk.DIALOG_DESTROY_WITH_PARENT, type = gtk.MESSAGE_ERROR, buttons = gtk.BUTTONS_OK, message_format = "Unknown extension '%s' (valid extensions are '.eps', '.svg', and '.pdf')" % (extension,)) dialog.run() dialog.destroy() return # draw the canvas to a printing context cr = cairo.Context(surface) cr.translate(-bounds.x1, -bounds.y1) self.canvas.render(cr, bounds, self.zoom.value) cr.show_page() surface.finish()
Example #26
Source File: interface_statistics.py From ns3-802.11ad with GNU General Public License v2.0 | 4 votes |
def __init__(self, visualizer, node_index, statistics_collector): """ Initializer. @param self this object @param visualizer the visualizer object @param node_index the node index @param statistics_collector statistics collector class """ 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 #27
Source File: olsr.py From ns3-802.11ad with GNU General Public License v2.0 | 4 votes |
def __init__(self, visualizer, node_index): """! Initializer @param self this object @param visualizer visualizer object @param node_index the node index @return none """ 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.set_default_size(gtk.gdk.screen_width()/2, gtk.gdk.screen_height()/2) self.win.connect("response", self._response_cb) self.win.set_title("OLSR routing table for node %i" % node_index) self.visualizer = visualizer self.node_index = node_index self.table_model = gtk.ListStore(str, str, str, int) treeview = gtk.TreeView(self.table_model) treeview.show() sw = gtk.ScrolledWindow() sw.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC, vscrollbar_policy=gtk.POLICY_AUTOMATIC) sw.show() sw.add(treeview) self.win.vbox.add(sw) # Dest. column = gtk.TreeViewColumn('Destination', gtk.CellRendererText(), text=self.COLUMN_DESTINATION) treeview.append_column(column) # Next hop column = gtk.TreeViewColumn('Next hop', gtk.CellRendererText(), text=self.COLUMN_NEXT_HOP) treeview.append_column(column) # Interface column = gtk.TreeViewColumn('Interface', gtk.CellRendererText(), text=self.COLUMN_INTERFACE) treeview.append_column(column) # Num. Hops column = gtk.TreeViewColumn('Num. Hops', gtk.CellRendererText(), text=self.COLUMN_NUM_HOPS) treeview.append_column(column) self.visualizer.add_information_window(self) self.win.show()
Example #28
Source File: ipv4_routing_table.py From ns3-802.11ad with GNU General Public License v2.0 | 4 votes |
def __init__(self, visualizer, node_index): """ Initializer @param self this object @param visualizer visualizer object @param node_index the node index @return the statistics """ 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("IPv4 routing table for node %i" % node_index) self.visualizer = visualizer self.node_index = node_index self.table_model = gtk.ListStore(str, str, str, str, int) treeview = gtk.TreeView(self.table_model) treeview.show() sw = gtk.ScrolledWindow() sw.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC, vscrollbar_policy=gtk.POLICY_AUTOMATIC) sw.show() sw.add(treeview) self.win.vbox.add(sw) self.win.set_default_size(600, 300) # Dest. column = gtk.TreeViewColumn('Destination', gtk.CellRendererText(), text=self.COLUMN_DESTINATION) treeview.append_column(column) # Next hop column = gtk.TreeViewColumn('Next hop', gtk.CellRendererText(), text=self.COLUMN_NEXT_HOP) treeview.append_column(column) # Interface column = gtk.TreeViewColumn('Interface', gtk.CellRendererText(), text=self.COLUMN_INTERFACE) treeview.append_column(column) # Type column = gtk.TreeViewColumn('Type', gtk.CellRendererText(), text=self.COLUMN_TYPE) treeview.append_column(column) # Prio column = gtk.TreeViewColumn('Prio', gtk.CellRendererText(), text=self.COLUMN_PRIO) treeview.append_column(column) self.visualizer.add_information_window(self) self.win.show()
Example #29
Source File: core.py From Tocino with GNU General Public License v2.0 | 4 votes |
def _take_screenshot(self, dummy_button): #print "Cheese!" file_name = self._get_export_file_name() if file_name is None: return # figure out the correct bounding box for what is visible on screen x1 = self._scrolled_window.get_hadjustment().value y1 = self._scrolled_window.get_vadjustment().value x2 = x1 + self._scrolled_window.get_hadjustment().page_size y2 = y1 + self._scrolled_window.get_vadjustment().page_size bounds = goocanvas.Bounds() bounds.x1, bounds.y1 = self.canvas.convert_from_pixels(x1, y1) bounds.x2, bounds.y2 = self.canvas.convert_from_pixels(x2, y2) dest_width = bounds.x2 - bounds.x1 dest_height = bounds.y2 - bounds.y1 #print bounds.x1, bounds.y1, " -> ", bounds.x2, bounds.y2 dummy, extension = os.path.splitext(file_name) extension = extension.lower() if extension == '.eps': surface = cairo.PSSurface(file_name, dest_width, dest_height) elif extension == '.pdf': surface = cairo.PDFSurface(file_name, dest_width, dest_height) elif extension == '.svg': surface = cairo.SVGSurface(file_name, dest_width, dest_height) else: dialog = gtk.MessageDialog(parent = self.canvas.get_toplevel(), flags = gtk.DIALOG_DESTROY_WITH_PARENT, type = gtk.MESSAGE_ERROR, buttons = gtk.BUTTONS_OK, message_format = "Unknown extension '%s' (valid extensions are '.eps', '.svg', and '.pdf')" % (extension,)) dialog.run() dialog.destroy() return # draw the canvas to a printing context cr = cairo.Context(surface) cr.translate(-bounds.x1, -bounds.y1) self.canvas.render(cr, bounds, self.zoom.value) cr.show_page() surface.finish()
Example #30
Source File: olsr.py From Tocino with GNU General Public License v2.0 | 4 votes |
def __init__(self, visualizer, node_index): 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.set_default_size(gtk.gdk.screen_width()/2, gtk.gdk.screen_height()/2) self.win.connect("response", self._response_cb) self.win.set_title("OLSR routing table for node %i" % node_index) self.visualizer = visualizer self.node_index = node_index self.table_model = gtk.ListStore(str, str, str, int) treeview = gtk.TreeView(self.table_model) treeview.show() sw = gtk.ScrolledWindow() sw.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC, vscrollbar_policy=gtk.POLICY_AUTOMATIC) sw.show() sw.add(treeview) self.win.vbox.add(sw) # Dest. column = gtk.TreeViewColumn('Destination', gtk.CellRendererText(), text=self.COLUMN_DESTINATION) treeview.append_column(column) # Next hop column = gtk.TreeViewColumn('Next hop', gtk.CellRendererText(), text=self.COLUMN_NEXT_HOP) treeview.append_column(column) # Interface column = gtk.TreeViewColumn('Interface', gtk.CellRendererText(), text=self.COLUMN_INTERFACE) treeview.append_column(column) # Num. Hops column = gtk.TreeViewColumn('Num. Hops', gtk.CellRendererText(), text=self.COLUMN_NUM_HOPS) treeview.append_column(column) self.visualizer.add_information_window(self) self.win.show()