1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 05:01:29 +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:
dmiller
2022-12-07 20:34:03 +00:00
parent e2e55660c3
commit 24b26317c7
104 changed files with 5381 additions and 4383 deletions

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/env python3
# ***********************IMPORTANT NMAP LICENSE TERMS************************
# * *
@@ -58,7 +57,10 @@
# * *
# ***************************************************************************/
import gtk
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
from zenmapGUI.higwidgets.higboxes import HIGVBox
@@ -74,11 +76,12 @@ xml.__path__ = [x for x in xml.__path__ if "_xmlplus" not in x]
from xml.sax.saxutils import escape
class BugReport(gtk.Window, object):
class BugReport(Gtk.Window, object):
def __init__(self):
gtk.Window.__init__(self)
Gtk.Window.__init__(self)
self.set_title(_('How to Report a Bug'))
self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
self.set_resizable(False)
self._create_widgets()
self._pack_widgets()
@@ -86,16 +89,17 @@ class BugReport(gtk.Window, object):
def _create_widgets(self):
self.vbox = HIGVBox()
self.button_box = gtk.HButtonBox()
self.button_box = Gtk.ButtonBox.new(Gtk.Orientation.HORIZONTAL)
self.text = gtk.Label()
self.text = Gtk.Label()
self.btn_ok = gtk.Button(stock=gtk.STOCK_OK)
self.btn_ok = Gtk.Button.new_from_stock(Gtk.STOCK_OK)
def _pack_widgets(self):
self.vbox.set_border_width(6)
self.text.set_line_wrap(True)
self.text.set_max_width_chars(50)
self.text.set_markup(_("""\
<big><b>How to report a bug</b></big>
@@ -124,8 +128,8 @@ https://nmap.org/data/HACKING. Patches may be sent to nmap-dev \
})
self.vbox.add(self.text)
self.button_box.set_layout(gtk.BUTTONBOX_END)
self.button_box.pack_start(self.btn_ok)
self.button_box.set_layout(Gtk.ButtonBoxStyle.END)
self.button_box.pack_start(self.btn_ok, True, True, 0)
self.vbox._pack_noexpand_nofill(self.button_box)
self.add(self.vbox)
@@ -140,6 +144,6 @@ https://nmap.org/data/HACKING. Patches may be sent to nmap-dev \
if __name__ == "__main__":
w = BugReport()
w.show_all()
w.connect("delete-event", lambda x, y: gtk.main_quit())
w.connect("delete-event", lambda x, y: Gtk.main_quit())
gtk.main()
Gtk.main()