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:
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# ***********************IMPORTANT NMAP LICENSE TERMS************************
|
||||
# * *
|
||||
@@ -58,8 +57,10 @@
|
||||
# * *
|
||||
# ***************************************************************************/
|
||||
|
||||
import gtk
|
||||
import pango
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Pango
|
||||
|
||||
from zenmapGUI.higwidgets.higboxes import HIGHBox, HIGVBox
|
||||
from zenmapGUI.higwidgets.higbuttons import HIGButton
|
||||
@@ -67,7 +68,7 @@ from zenmapGUI.higwidgets.higscrollers import HIGScrolledWindow
|
||||
import zenmapCore.I18N # lgtm[py/unused-import]
|
||||
|
||||
|
||||
def status_data_func(widget, cell_renderer, model, iter):
|
||||
def status_data_func(widget, cell_renderer, model, iter, data):
|
||||
entry = model.get_value(iter, 0)
|
||||
if entry.running:
|
||||
status = _("Running")
|
||||
@@ -83,9 +84,9 @@ def status_data_func(widget, cell_renderer, model, iter):
|
||||
cell_renderer.set_property("text", status)
|
||||
|
||||
|
||||
def command_data_func(widget, cell_renderer, model, iter):
|
||||
def command_data_func(widget, cell_renderer, model, iter, data):
|
||||
entry = model.get_value(iter, 0)
|
||||
cell_renderer.set_property("ellipsize", pango.ELLIPSIZE_END)
|
||||
cell_renderer.set_property("ellipsize", Pango.EllipsizeMode.END)
|
||||
cell_renderer.set_property("text", entry.get_command_string())
|
||||
|
||||
|
||||
@@ -100,19 +101,19 @@ class ScanScanListPage(HIGVBox):
|
||||
|
||||
scans_store.connect("row-changed", self._row_changed)
|
||||
|
||||
self.scans_list = gtk.TreeView(scans_store)
|
||||
self.scans_list = Gtk.TreeView.new_with_model(scans_store)
|
||||
self.scans_list.get_selection().connect(
|
||||
"changed", self._selection_changed)
|
||||
|
||||
status_col = gtk.TreeViewColumn(_("Status"))
|
||||
cell = gtk.CellRendererText()
|
||||
status_col.pack_start(cell)
|
||||
status_col = Gtk.TreeViewColumn(title=_("Status"))
|
||||
cell = Gtk.CellRendererText()
|
||||
status_col.pack_start(cell, True)
|
||||
status_col.set_cell_data_func(cell, status_data_func)
|
||||
self.scans_list.append_column(status_col)
|
||||
|
||||
command_col = gtk.TreeViewColumn(_("Command"))
|
||||
cell = gtk.CellRendererText()
|
||||
command_col.pack_start(cell)
|
||||
command_col = Gtk.TreeViewColumn(title=_("Command"))
|
||||
cell = Gtk.CellRendererText()
|
||||
command_col.pack_start(cell, True)
|
||||
command_col.set_cell_data_func(cell, command_data_func)
|
||||
self.scans_list.append_column(command_col)
|
||||
|
||||
@@ -120,25 +121,25 @@ class ScanScanListPage(HIGVBox):
|
||||
scrolled_window.set_border_width(0)
|
||||
scrolled_window.add(self.scans_list)
|
||||
|
||||
self.pack_start(scrolled_window, True, True)
|
||||
self.pack_start(scrolled_window, True, True, 0)
|
||||
|
||||
hbox = HIGHBox()
|
||||
buttonbox = gtk.HButtonBox()
|
||||
buttonbox.set_layout(gtk.BUTTONBOX_START)
|
||||
buttonbox = Gtk.ButtonBox.new(Gtk.Orientation.HORIZONTAL)
|
||||
buttonbox.set_layout(Gtk.ButtonBoxStyle.START)
|
||||
buttonbox.set_spacing(4)
|
||||
|
||||
self.append_button = HIGButton(_("Append Scan"), gtk.STOCK_ADD)
|
||||
buttonbox.pack_start(self.append_button, False)
|
||||
self.append_button = HIGButton(_("Append Scan"), Gtk.STOCK_ADD)
|
||||
buttonbox.pack_start(self.append_button, False, True, 0)
|
||||
|
||||
self.remove_button = HIGButton(_("Remove Scan"), gtk.STOCK_REMOVE)
|
||||
buttonbox.pack_start(self.remove_button, False)
|
||||
self.remove_button = HIGButton(_("Remove Scan"), Gtk.STOCK_REMOVE)
|
||||
buttonbox.pack_start(self.remove_button, False, True, 0)
|
||||
|
||||
self.cancel_button = HIGButton(_("Cancel Scan"), gtk.STOCK_CANCEL)
|
||||
buttonbox.pack_start(self.cancel_button, False)
|
||||
self.cancel_button = HIGButton(_("Cancel Scan"), Gtk.STOCK_CANCEL)
|
||||
buttonbox.pack_start(self.cancel_button, False, True, 0)
|
||||
|
||||
hbox.pack_start(buttonbox, padding=4)
|
||||
hbox.pack_start(buttonbox, True, True, 4)
|
||||
|
||||
self.pack_start(hbox, False, padding=4)
|
||||
self.pack_start(hbox, False, True, 4)
|
||||
|
||||
self._update()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user