mirror of
https://github.com/nmap/nmap.git
synced 2025-12-11 18:29:03 +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************************
|
||||
# * *
|
||||
@@ -66,29 +65,39 @@ higwidgets/higboxes.py
|
||||
|
||||
__all__ = ['HIGHBox', 'HIGVBox']
|
||||
|
||||
import gtk
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
|
||||
|
||||
class HIGBox(gtk.Box):
|
||||
class HIGBox(Gtk.Box):
|
||||
def _pack_noexpand_nofill(self, widget):
|
||||
self.pack_start(widget, expand=False, fill=False)
|
||||
self.pack_start(widget, False, False, 0)
|
||||
|
||||
def _pack_expand_fill(self, widget):
|
||||
self.pack_start(widget, expand=True, fill=True)
|
||||
self.pack_start(widget, True, True, 0)
|
||||
|
||||
def add(self, widget):
|
||||
# Make default packing arguments same as before (Gtk.Box has expand
|
||||
# set to False by default).
|
||||
self.pack_start(widget, True, True, 0)
|
||||
|
||||
|
||||
class HIGHBox(gtk.HBox, HIGBox):
|
||||
class HIGHBox(HIGBox):
|
||||
def __init__(self, homogeneous=False, spacing=12):
|
||||
gtk.HBox.__init__(self, homogeneous, spacing)
|
||||
Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL,
|
||||
homogeneous=homogeneous, spacing=spacing)
|
||||
|
||||
pack_section_label = HIGBox._pack_noexpand_nofill
|
||||
pack_label = HIGBox._pack_noexpand_nofill
|
||||
pack_entry = HIGBox._pack_expand_fill
|
||||
|
||||
|
||||
class HIGVBox(gtk.VBox, HIGBox):
|
||||
class HIGVBox(HIGBox):
|
||||
def __init__(self, homogeneous=False, spacing=12):
|
||||
gtk.VBox.__init__(self, homogeneous, spacing)
|
||||
Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL,
|
||||
homogeneous=homogeneous, spacing=spacing)
|
||||
|
||||
# Packs a widget as a line, so it doesn't expand vertically
|
||||
pack_line = HIGBox._pack_noexpand_nofill
|
||||
@@ -110,4 +119,4 @@ class HIGSpacer(HIGHBox):
|
||||
|
||||
|
||||
def hig_box_space_holder():
|
||||
return gtk.Label(" ")
|
||||
return Gtk.Label.new(" ")
|
||||
|
||||
Reference in New Issue
Block a user