mirror of
https://github.com/nmap/nmap.git
synced 2025-12-14 11:49:01 +00:00
Merge #2088: Update Zenmap to Python 3 and PyGObject
Note: Ndiff build will be broken until subsequent changes are made. Deprecation warnings will need to be addressed in future changes. Closes #2088
This commit is contained in:
@@ -57,19 +57,21 @@
|
||||
# * *
|
||||
# ***************************************************************************/
|
||||
|
||||
import gtk
|
||||
import gobject
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GObject
|
||||
|
||||
|
||||
class BWChangeableComboBoxEntry(gtk.ComboBoxEntry):
|
||||
class BWChangeableComboBoxEntry(Gtk.ComboBoxText):
|
||||
"""
|
||||
"""
|
||||
def __init__(self):
|
||||
"""
|
||||
"""
|
||||
self.__liststore = gtk.ListStore(gobject.TYPE_STRING)
|
||||
self.__liststore = Gtk.ListStore.new([str])
|
||||
|
||||
gtk.ComboBoxEntry.__init__(self, self.__liststore, 0)
|
||||
Gtk.ComboBoxText.__init__(self, model=self.__liststore, has_entry=True)
|
||||
|
||||
self.connect("changed", self.__changed)
|
||||
self.get_child().connect("changed", self.__entry_changed)
|
||||
@@ -114,22 +116,22 @@ if __name__ == "__main__":
|
||||
"""
|
||||
combo.append_text('New')
|
||||
|
||||
window = gtk.Window()
|
||||
window.connect("destroy", lambda w: gtk.main_quit())
|
||||
window = Gtk.Window()
|
||||
window.connect("destroy", lambda w: Gtk.main_quit())
|
||||
|
||||
box = gtk.HBox()
|
||||
box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
|
||||
|
||||
combo = BWChangeableComboBoxEntry()
|
||||
combo.append_text('New')
|
||||
combo.set_active(0)
|
||||
|
||||
button = gtk.Button('More')
|
||||
button = Gtk.Button.new_with_label('More')
|
||||
button.connect("clicked", button_clicked, combo)
|
||||
|
||||
box.pack_start(button, False, False)
|
||||
box.pack_start(combo, True, True)
|
||||
box.pack_start(button, False, False, 0)
|
||||
box.pack_start(combo, True, True, 0)
|
||||
|
||||
window.add(box)
|
||||
window.show_all()
|
||||
|
||||
gtk.main()
|
||||
Gtk.main()
|
||||
|
||||
Reference in New Issue
Block a user