diff options
| -rwxr-xr-x | src/msec/msecgui.py | 68 |
1 files changed, 39 insertions, 29 deletions
diff --git a/src/msec/msecgui.py b/src/msec/msecgui.py index a39577a..abb2a8e 100755 --- a/src/msec/msecgui.py +++ b/src/msec/msecgui.py @@ -111,6 +111,17 @@ SAVE_SETTINGS_TEXT=_("""Save and apply new configuration?""") DEFAULT_SPACING=5 BANNER="msec.png" +# Box helpers to replace deprecated Gtk.VBox / Gtk.HBox +def VBox(spacing=0, homogeneous=False, **kwargs): + box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=spacing, **kwargs) + box.set_homogeneous(homogeneous) + return box + +def HBox(spacing=0, homogeneous=False, **kwargs): + box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=spacing, **kwargs) + box.set_homogeneous(homogeneous) + return box + class BackgroundRunner(Thread): # background task runner def __init__(self, finish, program): @@ -187,7 +198,7 @@ class MsecGui(Gtk.Window): self.enforced_level = None self.enforcing_level = False - main_vbox = Gtk.VBox(homogeneous=False, spacing=5) + main_vbox = VBox(spacing=5) self.window.add(main_vbox) # menu @@ -227,7 +238,7 @@ class MsecGui(Gtk.Window): menu.add(menuitem) # show logo - banner = Gtk.HBox(homogeneous=False, spacing=10) + banner = HBox(spacing=10) try: # logo image = Gtk.Image() @@ -354,7 +365,7 @@ class MsecGui(Gtk.Window): dialog.set_resizable(False) # detailed information - exp_vbox = Gtk.VBox() + exp_vbox = VBox() # scrolledwindow sw = Gtk.ScrolledWindow() @@ -363,7 +374,7 @@ class MsecGui(Gtk.Window): exp_vbox.pack_start(sw, True, True, DEFAULT_SPACING) - vbox = Gtk.VBox() + vbox = VBox() exp_vbox.set_size_request(640, 280) sw.add(vbox) @@ -388,7 +399,7 @@ class MsecGui(Gtk.Window): # adding specific messages advanced = Gtk.Expander(label=_("Details")) - vbox_advanced = Gtk.VBox() + vbox_advanced = VBox() advanced.add(vbox_advanced) vbox.pack_start(advanced, False, False, padding=DEFAULT_SPACING) for cat in ['info', 'critical', 'error', 'warn', 'debug']: @@ -559,7 +570,7 @@ class MsecGui(Gtk.Window): def create_summary_ui(self): """Builds the security summary UI""" - vbox = Gtk.VBox(homogeneous=False, spacing=20) + vbox = VBox(spacing=20) grid = Gtk.Grid() grid.set_column_spacing(10) @@ -650,7 +661,7 @@ class MsecGui(Gtk.Window): label.set_halign(Gtk.Align.FILL) grid.attach(label, 2, row, 1, 1) - h = Gtk.HBox() + h = HBox(spacing=6) button_show = Gtk.Button(label=_("Show results")) if updated_n: button_show.connect('clicked', self.show_test_results, logfile) @@ -724,7 +735,7 @@ class MsecGui(Gtk.Window): progress.set_modal(True) progress.connect('delete-event', lambda *w: None) - vbox = Gtk.VBox(spacing=10) + vbox = VBox(spacing=10) progress.add(vbox) progressbar = Gtk.ProgressBar() progressbar.set_text(_("Please wait, running checks...")) @@ -787,7 +798,7 @@ class MsecGui(Gtk.Window): def level_security_page(self, id): """Builds the basic security page""" - vbox = Gtk.VBox(homogeneous=False) + vbox = VBox() entry = Gtk.Label(label=LEVEL_SECURITY_TEXT) entry.set_use_markup(True) @@ -802,7 +813,7 @@ class MsecGui(Gtk.Window): # security levels self.levels_frame = Gtk.Frame.new(_("Select the base security level")) - levels_vbox = Gtk.VBox(homogeneous=False) + levels_vbox = VBox() self.levels_frame.add(levels_vbox) # create the security level selection screen sw = Gtk.ScrolledWindow() @@ -879,7 +890,7 @@ class MsecGui(Gtk.Window): # putting levels to vbox # notifications by email - hbox = Gtk.HBox() + hbox = HBox() self.notify_mail = Gtk.CheckButton(label=_("Send security alerts by email to:")) if self.msecconfig.get("MAIL_WARN") == "yes": self.notify_mail.set_active(True) @@ -1048,7 +1059,7 @@ class MsecGui(Gtk.Window): def system_security_page(self, id): """Builds the system security page""" - vbox = Gtk.VBox(homogeneous=False) + vbox = VBox() entry = Gtk.Label(label=SYSTEM_SECURITY_TEXT) entry.set_use_markup(True) @@ -1063,7 +1074,7 @@ class MsecGui(Gtk.Window): def network_security_page(self, id): """Builds the network security page""" - vbox = Gtk.VBox(homogeneous=False) + vbox = VBox() entry = Gtk.Label(label=NETWORK_SECURITY_TEXT) entry.set_use_markup(True) @@ -1078,7 +1089,7 @@ class MsecGui(Gtk.Window): def periodic_security_page(self, id): """Builds the periodic security page""" - vbox = Gtk.VBox(homogeneous=False) + vbox = VBox() entry = Gtk.Label(label=PERIODIC_SECURITY_TEXT) entry.set_use_markup(True) @@ -1121,7 +1132,7 @@ class MsecGui(Gtk.Window): def exceptions_page(self, id): """Builds the exceptions page""" - vbox = Gtk.VBox(homogeneous=False) + vbox = VBox() entry = Gtk.Label(label=EXCEPTIONS_TEXT) entry.set_use_markup(True) @@ -1171,7 +1182,7 @@ class MsecGui(Gtk.Window): self.current_options_view[id] = (lstore, self.exceptions) # buttons hbox - hbox = Gtk.HBox(homogeneous=True, spacing=10) + hbox = HBox(homogeneous=True, spacing=10) # add button = Gtk.Button(label=_("Add a rule")) @@ -1189,7 +1200,7 @@ class MsecGui(Gtk.Window): def permissions_security_page(self, id): """Builds the permissions security page""" - vbox = Gtk.VBox(homogeneous=False) + vbox = VBox() entry = Gtk.Label(label=PERMISSIONS_SECURITY_TEXT) entry.set_use_markup(True) @@ -1282,7 +1293,7 @@ class MsecGui(Gtk.Window): self.current_options_view[id] = (lstore, self.permconfig) # buttons hbox - hbox = Gtk.HBox(homogeneous=True, spacing=10) + hbox = HBox(homogeneous=True, spacing=10) # # up # button = Gtk.Button(_("Up")) @@ -1422,7 +1433,7 @@ class MsecGui(Gtk.Window): dialog.vbox.pack_start(label, False, False, 0) # module - hbox = Gtk.HBox() + hbox = HBox() hbox.pack_start(Gtk.Label(label=_("Check: ")), True, True, 0) entry_module = Gtk.ComboBoxText() pos = 0 @@ -1437,7 +1448,7 @@ class MsecGui(Gtk.Window): dialog.vbox.pack_start(hbox, False, False, 0) # exception - hbox = Gtk.HBox() + hbox = HBox() hbox.pack_start(Gtk.Label(label=_("Exception: ")), True, True, 0) entry_exception = Gtk.Entry() entry_exception.set_text(exception) @@ -1504,7 +1515,7 @@ class MsecGui(Gtk.Window): if not path: # file - hbox = Gtk.HBox() + hbox = HBox() label = Gtk.Label(label=_("File: ")) hbox.pack_start(label, True, True, 0) entry_file = Gtk.Entry() @@ -1520,7 +1531,7 @@ class MsecGui(Gtk.Window): dialog.vbox.pack_start(label, False, False, padding=5) # user - hbox = Gtk.HBox() + hbox = HBox() label = Gtk.Label(label=_("User: ")) hbox.pack_start(label, True, True, 0) entry_user = Gtk.Entry() @@ -1531,7 +1542,7 @@ class MsecGui(Gtk.Window): dialog.vbox.pack_start(hbox, False, False, 0) # group - hbox = Gtk.HBox() + hbox = HBox() label = Gtk.Label(label=_("Group: ")) hbox.pack_start(label, True, True, 0) entry_group = Gtk.Entry() @@ -1542,7 +1553,7 @@ class MsecGui(Gtk.Window): dialog.vbox.pack_start(hbox, False, False, 0) # perm - hbox = Gtk.HBox() + hbox = HBox() label = Gtk.Label(label=_("Permissions: ")) hbox.pack_start(label, True, True, 0) entry_perm = Gtk.Entry() @@ -1558,7 +1569,7 @@ class MsecGui(Gtk.Window): dialog.vbox.pack_start(label, False, False, padding=5) # acl - hbox = Gtk.HBox() + hbox = HBox() label = Gtk.Label(label=_("ACL: ")) hbox.pack_start(label, True, True, 0) entry_acl = Gtk.Entry() @@ -1636,15 +1647,14 @@ class MsecGui(Gtk.Window): # description dialog.vbox.pack_start(label, True, True, 0) label = Gtk.Label(label=_("<i>%s</i>\n\n\tCurrent value:\t\t\t<i>%s</i>\n\t%sDefault level value:\t<i>%s</i>%s\n") % - (descr, value, - def_start, val_def, def_end,)) + (descr, value, def_start, val_def, def_end,)) label.set_line_wrap(True) label.set_use_markup(True) dialog.vbox.pack_start(label, True, True, 0) - dialog.vbox.pack_start(Gtk.HSeparator(), True, True, 0) + dialog.vbox.pack_start(Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL), True, True, 0) # new value - hbox = Gtk.HBox() + hbox = HBox() label = Gtk.Label(label=_("New value:")) label.set_halign(Gtk.Align.CENTER) label.set_valign(Gtk.Align.CENTER) |
