aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2014-02-09 19:02:16 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2014-02-09 19:32:03 +0100
commit0949ade542bde947eb6091130f1a752e1d55152d (patch)
tree7f49cdea54f3fd3b7a18175adf4ccf185b82abf8 /src
parentdb264347118c3f3cd6b59be88c1b716477e379fc (diff)
downloadmsec-0949ade542bde947eb6091130f1a752e1d55152d.tar
msec-0949ade542bde947eb6091130f1a752e1d55152d.tar.gz
msec-0949ade542bde947eb6091130f1a752e1d55152d.tar.bz2
msec-0949ade542bde947eb6091130f1a752e1d55152d.tar.xz
msec-0949ade542bde947eb6091130f1a752e1d55152d.zip
automatic conversion from gtk2 to gtk3
Diffstat (limited to 'src')
-rwxr-xr-xsrc/msec/msecgui.py542
1 files changed, 271 insertions, 271 deletions
diff --git a/src/msec/msecgui.py b/src/msec/msecgui.py
index 63eec41..1460f04 100755
--- a/src/msec/msecgui.py
+++ b/src/msec/msecgui.py
@@ -18,10 +18,10 @@ import time
import warnings
warnings.filterwarnings('error', module='gtk')
try:
- import gtk
- import pygtk
- import gobject
- import pango
+ from gi.repository import Gtk
+ import gi
+ from gi.repository import GObject
+ from gi.repository import Pango
except Warning, e:
print "ERROR: %s" % e
print "Exiting.."
@@ -172,10 +172,10 @@ class MsecGui:
if embed:
# embedding in MCC
- self.window = gtk.Plug(embed)
+ self.window = Gtk.Plug(embed)
else:
# running standalone
- self.window = gtk.Window()
+ self.window = Gtk.Window()
self.window.set_default_size(640, 440)
self.window.connect('delete-event', self.quit)
@@ -183,11 +183,11 @@ class MsecGui:
self.enforced_level = None
self.enforcing_level = False
- main_vbox = gtk.VBox(homogeneous=False, spacing=5)
+ main_vbox = Gtk.VBox(homogeneous=False, spacing=5)
self.window.add(main_vbox)
# menu
- menubar = gtk.MenuBar()
+ menubar = Gtk.MenuBar()
main_vbox.pack_start(menubar, False, False)
menus = [
(_("_File"),
@@ -208,13 +208,13 @@ class MsecGui:
# building menus
for topmenu, items in menus:
# file menu
- filemenu = gtk.MenuItem(topmenu)
+ filemenu = Gtk.MenuItem(topmenu)
menubar.add(filemenu)
- menu = gtk.Menu()
+ menu = Gtk.Menu()
filemenu.set_submenu(menu)
group = None
for submenu, callback in items:
- menuitem = gtk.MenuItem(submenu)
+ menuitem = Gtk.MenuItem(submenu)
if callback:
menuitem.connect('activate', callback)
else:
@@ -222,28 +222,28 @@ class MsecGui:
menu.add(menuitem)
# show logo
- banner = gtk.HBox(homogeneous=False, spacing=10)
+ banner = Gtk.HBox(homogeneous=False, spacing=10)
try:
# logo
- image = gtk.Image()
- pixbuf = gtk.gdk.pixbuf_new_from_file("%s/%s" % (config.MSEC_DIR, BANNER))
+ image = Gtk.Image()
+ pixbuf = GdkPixbuf.Pixbuf.new_from_file("%s/%s" % (config.MSEC_DIR, BANNER))
image.set_from_pixbuf(pixbuf)
banner.pack_start(image, False, False)
- label = gtk.Label(_("MSEC: System Security and Audit"))
- label.modify_font(pango.FontDescription("13"))
+ label = Gtk.Label(label=_("MSEC: System Security and Audit"))
+ label.modify_font(Pango.FontDescription("13"))
banner.pack_start(label, False, False)
main_vbox.pack_start(banner, False, False)
except:
print "Banner %s Not found" % ("%s/%s" % (config.MSEC_DIR, BANNER))
# creating main UI
- self.main_notebook = gtk.Notebook()
- main_vbox.pack_start(self.main_notebook)
+ self.main_notebook = Gtk.Notebook()
+ main_vbox.pack_start(self.main_notebook, True, True, 0)
# creating tabs
- self.notebook = gtk.Notebook()
- self.main_notebook.append_page(self.create_summary_ui(), gtk.Label(_("Overview")))
- self.main_notebook.append_page(self.notebook, gtk.Label(_("Security settings")))
+ self.notebook = Gtk.Notebook()
+ self.main_notebook.append_page(self.create_summary_ui(), Gtk.Label(label=_("Overview")))
+ self.main_notebook.append_page(self.notebook, Gtk.Label(label=_("Security settings")))
# data to change the values
self.current_options_view = {}
@@ -260,14 +260,14 @@ class MsecGui:
(6, self.permissions_security_page, _("Permissions")),
]
for id, callback, label in tabs:
- self.notebook.append_page(callback(id), gtk.Label(label))
+ self.notebook.append_page(callback(id), Gtk.Label(label=label))
# are we enabled?
self.toggle_level(self.base_level)
# pending signals
self.signals = Queue.Queue()
- gobject.timeout_add(500, self.check_signals)
+ GObject.timeout_add(500, self.check_signals)
self.window.show_all()
@@ -284,7 +284,7 @@ class MsecGui:
s = self.signals.get()
if s == signal.SIGTERM:
self.quit(self.window)
- gobject.timeout_add(500, self.check_signals)
+ GObject.timeout_add(500, self.check_signals)
def check_for_changes(self, curconfig, curperms):
"""Checks for changes in configuration. Returns number of configuration
@@ -335,39 +335,39 @@ class MsecGui:
# creating preview window
if ask_ignore:
- dialog = gtk.Dialog(_("Saving changes.."),
- self.window, gtk.DIALOG_MODAL,
- (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
- _("Ignore and quit"), gtk.RESPONSE_REJECT,
- gtk.STOCK_OK, gtk.RESPONSE_OK)
+ dialog = Gtk.Dialog(_("Saving changes.."),
+ self.window, Gtk.DialogFlags.MODAL,
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
+ _("Ignore and quit"), Gtk.ResponseType.REJECT,
+ Gtk.STOCK_OK, Gtk.ResponseType.OK)
)
else:
- dialog = gtk.Dialog(_("Saving changes.."),
- self.window, gtk.DIALOG_MODAL,
- (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
- gtk.STOCK_OK, gtk.RESPONSE_OK)
+ dialog = Gtk.Dialog(_("Saving changes.."),
+ self.window, Gtk.DialogFlags.MODAL,
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
+ Gtk.STOCK_OK, Gtk.ResponseType.OK)
)
dialog.set_default_size(640, 300)
- dialog.set_default_response(gtk.RESPONSE_OK)
+ dialog.set_default_response(Gtk.ResponseType.OK)
- label = gtk.Label(SAVE_SETTINGS_TEXT)
+ label = Gtk.Label(label=SAVE_SETTINGS_TEXT)
dialog.vbox.set_spacing(DEFAULT_SPACING)
dialog.vbox.pack_start(label, False, False, padding=DEFAULT_SPACING)
dialog.set_resizable(False)
# detailed information
- exp_vbox = gtk.VBox()
+ exp_vbox = Gtk.VBox()
# scrolledwindow
- sw = gtk.ScrolledWindow()
- sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
- sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
- exp_vbox.pack_start(sw, padding=DEFAULT_SPACING)
+ sw = Gtk.ScrolledWindow()
+ sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
+ sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
+ exp_vbox.pack_start(sw, True, True, DEFAULT_SPACING)
- vbox = gtk.VBox()
+ vbox = Gtk.VBox()
exp_vbox.set_size_request(640, 280)
sw.add_with_viewport(vbox)
@@ -376,14 +376,14 @@ class MsecGui:
# TODO: FIX
for name, changes in allchanges:
- label = gtk.Label(_('<b>%s:</b> <i>%s</i>\n') % (name, changes))
+ label = Gtk.Label(label=_('<b>%s:</b> <i>%s</i>\n') % (name, changes))
label.set_use_markup(True)
label.set_property("xalign", 0.0)
vbox.pack_start(label, False, False, padding=DEFAULT_SPACING)
# see if there were any changes to system files
for msg in messages['info']:
if msg.find(config.MODIFICATIONS_FOUND) != -1 or msg.find(config.MODIFICATIONS_NOT_FOUND) != -1:
- label = gtk.Label(_("<b>MSEC test run results:</b> <i>%s</i>") % msg)
+ label = Gtk.Label(label=_("<b>MSEC test run results:</b> <i>%s</i>") % msg)
label.set_line_wrap(True)
label.set_use_markup(True)
label.set_property("xalign", 0.0)
@@ -391,15 +391,15 @@ class MsecGui:
break
# adding specific messages
- advanced = gtk.Expander(_("Details"))
- vbox_advanced = gtk.VBox()
+ advanced = Gtk.Expander(_("Details"))
+ vbox_advanced = Gtk.VBox()
advanced.add(vbox_advanced)
vbox.pack_start(advanced, False, False, padding=DEFAULT_SPACING)
for cat in ['info', 'critical', 'error', 'warn', 'debug']:
msgs = messages[cat]
- expander = gtk.Expander(_('MSEC messages (%s): %d') % (cat, len(msgs)))
- textview = gtk.TextView()
- textview.set_wrap_mode(gtk.WRAP_WORD_CHAR)
+ expander = Gtk.Expander(_('MSEC messages (%s): %d') % (cat, len(msgs)))
+ textview = Gtk.TextView()
+ textview.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
textview.set_editable(False)
expander.add(textview)
count = 1
@@ -411,13 +411,13 @@ class MsecGui:
vbox_advanced.pack_start(expander, False, False, padding=DEFAULT_SPACING)
# hide all information in an expander
- expander = gtk.Expander(_("Details (%d changes)..") % num_changes)
+ expander = Gtk.Expander(_("Details (%d changes)..") % num_changes)
expander.add(exp_vbox)
dialog.vbox.pack_start(expander, False, False, padding=DEFAULT_SPACING)
dialog.show_all()
response = dialog.run()
- if response != gtk.RESPONSE_OK:
+ if response != Gtk.ResponseType.OK:
dialog.destroy()
return response
dialog.destroy()
@@ -472,19 +472,19 @@ class MsecGui:
def create_treeview(self, options):
"""Creates a treeview from given list of options"""
- sw = gtk.ScrolledWindow()
- sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
- sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
+ sw = Gtk.ScrolledWindow()
+ sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
+ sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
# list of options
- lstore = gtk.ListStore(
- gobject.TYPE_STRING,
- gobject.TYPE_STRING,
- gobject.TYPE_STRING,
- gobject.TYPE_INT)
+ lstore = Gtk.ListStore(
+ GObject.TYPE_STRING,
+ GObject.TYPE_STRING,
+ GObject.TYPE_STRING,
+ GObject.TYPE_INT)
# treeview
- treeview = gtk.TreeView(lstore)
+ treeview = Gtk.TreeView(lstore)
treeview.set_rules_hint(True)
treeview.set_search_column(self.COLUMN_DESCR)
@@ -493,24 +493,24 @@ class MsecGui:
# configuring columns
# column for option names
- renderer = gtk.CellRendererText()
+ renderer = Gtk.CellRendererText()
renderer.set_property('width', 200)
- column = gtk.TreeViewColumn(_('Security Option'), renderer, text=self.COLUMN_OPTION, weight=self.COLUMN_CUSTOM)
+ column = Gtk.TreeViewColumn(_('Security Option'), renderer, text=self.COLUMN_OPTION, weight=self.COLUMN_CUSTOM)
column.set_sort_column_id(self.COLUMN_OPTION)
column.set_resizable(True)
column.set_expand(True)
treeview.append_column(column)
# column for descriptions
- renderer = gtk.CellRendererText()
+ renderer = Gtk.CellRendererText()
renderer.set_property('wrap-width', 400)
- renderer.set_property('wrap-mode', pango.WRAP_WORD_CHAR)
+ renderer.set_property('wrap-mode', Pango.WrapMode.WORD_CHAR)
column = treeview.insert_column_with_attributes(-1, _('Description'), renderer, text=self.COLUMN_DESCR, weight=self.COLUMN_CUSTOM)
column.set_expand(True)
#treeview.append_column(column)
# column for values
- column = gtk.TreeViewColumn(_('Value'), gtk.CellRendererText(), text=self.COLUMN_VALUE, weight=self.COLUMN_CUSTOM)
+ column = Gtk.TreeViewColumn(_('Value'), Gtk.CellRendererText(), text=self.COLUMN_VALUE, weight=self.COLUMN_CUSTOM)
column.set_sort_column_id(self.COLUMN_VALUE)
treeview.append_column(column)
@@ -536,9 +536,9 @@ class MsecGui:
# was it changed? if yes, change description to italic
if self.option_is_changed(option, value):
- custom = pango.WEIGHT_BOLD
+ custom = Pango.Weight.BOLD
else:
- custom = pango.WEIGHT_NORMAL
+ custom = Pango.Weight.NORMAL
# building the option
iter = lstore.append()
@@ -563,43 +563,43 @@ class MsecGui:
def create_summary_ui(self):
"""Builds the security summary UI"""
- vbox = gtk.VBox(homogeneous=False, spacing=20)
+ vbox = Gtk.VBox(homogeneous=False, spacing=20)
- table = gtk.Table(4, 4, False)
+ table = Gtk.Table(4, 4, False)
def create_security_item(table, row, text, icon=None):
# show logo
- banner = gtk.HBox(homogeneous=False, spacing=10)
+ banner = Gtk.HBox(homogeneous=False, spacing=10)
if icon:
try:
# logo
- image = gtk.Image()
- pixbuf = gtk.gdk.pixbuf_new_from_file(icon)
+ image = Gtk.Image()
+ pixbuf = GdkPixbuf.Pixbuf.new_from_file(icon)
image.set_from_pixbuf(pixbuf)
banner.pack_start(image, False, False)
- table.attach(banner, 0, 1, row, row+1, gtk.EXPAND | gtk.FILL, 0, 0, 0)
+ table.attach(banner, 0, 1, row, row+1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 0, 0, 0)
except:
print "Unable to load icon %s: %s" % (icon, sys.exc_value)
- label = gtk.Label(text)
+ label = Gtk.Label(label=text)
label.set_property("xalign", 0.0)
- label.modify_font(pango.FontDescription("12"))
+ label.modify_font(Pango.FontDescription("12"))
label.set_property("xalign", 0.0)
label.set_property("yalign", 0.5)
- table.attach(label, 1, 2, row, row + 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)
+ table.attach(label, 1, 2, row, row + 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 0, 0, 0)
row = 0
# firewall
create_security_item(table, row, _("Firewall"), "/usr/share/mcc/themes/default/firewall-mdk.png")
firewall_status = tools.find_firewall_info(log)
- label = gtk.Label(firewall_status)
+ label = Gtk.Label(label=firewall_status)
label.set_property("xalign", 0.0)
label.set_property("yalign", 0.5)
- table.attach(label, 2, 3, row, row + 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)
+ table.attach(label, 2, 3, row, row + 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 0, 0, 0)
- button = gtk.Button(_("Configure"))
+ button = Gtk.Button(_("Configure"))
button.connect('clicked', self.run_configure_app, tools.FIREWALL_CMD)
- table.attach(button, 3, 4, row, row + 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)
+ table.attach(button, 3, 4, row, row + 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 0, 0, 0)
vbox.pack_start(table, False, False)
row += 1
@@ -607,13 +607,13 @@ class MsecGui:
# updates
create_security_item(table, row, _("Updates"), "/usr/share/mcc/themes/default/MageiaUpdate.png")
updates = tools.get_updates_status(log)
- label = gtk.Label(updates)
+ label = Gtk.Label(label=updates)
label.set_property("xalign", 0.0)
label.set_property("yalign", 0.5)
- table.attach(label, 2, 3, row, row + 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)
- button = gtk.Button(_("Update now"))
+ table.attach(label, 2, 3, row, row + 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 0, 0, 0)
+ button = Gtk.Button(_("Update now"))
button.connect('clicked', self.run_configure_app, tools.UPDATE_CMD)
- table.attach(button, 3, 4, row, row + 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)
+ table.attach(button, 3, 4, row, row + 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 0, 0, 0)
row += 1
@@ -634,50 +634,50 @@ class MsecGui:
custom_count += 1
if custom_count > 0:
msec_status.append(_("Custom settings: %d") % custom_count)
- label = gtk.Label("\n".join(msec_status))
+ label = Gtk.Label(label="\n".join(msec_status))
label.set_property("xalign", 0.0)
label.set_property("yalign", 0.5)
- table.attach(label, 2, 3, row, row + 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)
+ table.attach(label, 2, 3, row, row + 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 0, 0, 0)
- button = gtk.Button(_("Configure"))
+ button = Gtk.Button(_("Configure"))
button.connect('clicked', lambda x: self.main_notebook.set_current_page(1))
- table.attach(button, 3, 4, row, row + 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)
+ table.attach(button, 3, 4, row, row + 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 0, 0, 0)
row += 1
# msec reports
- label = gtk.Label(_("Periodic checks"))
+ label = Gtk.Label(label=_("Periodic checks"))
label.set_property("xalign", 0.0)
label.set_property("yalign", 0.5)
- label.modify_font(pango.FontDescription("11"))
- table.attach(label, 2, 3, row, row + 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)
+ label.modify_font(Pango.FontDescription("11"))
+ table.attach(label, 2, 3, row, row + 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 0, 0, 0)
row += 1
for check, logfile, updated_n, updated in tools.periodic_check_status(log):
if not updated:
updated = _("Never")
- label = gtk.Label(_("Check: %s. Last run: %s") % (check, updated))
+ label = Gtk.Label(label=_("Check: %s. Last run: %s") % (check, updated))
label.set_property("xalign", 0.0)
- table.attach(label, 2, 3, row, row + 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)
+ table.attach(label, 2, 3, row, row + 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 0, 0, 0)
- h = gtk.HBox()
- button = gtk.Button(_("Show results"))
+ h = Gtk.HBox()
+ button = Gtk.Button(_("Show results"))
if updated_n:
button.connect('clicked', self.show_test_results, logfile)
else:
button.set_sensitive(False)
h.pack_start(button, False, False)
- button = gtk.Button(_("Run now"))
+ button = Gtk.Button(_("Run now"))
button.connect('clicked', self.run_periodic_check, check)
h.pack_start(button, False, False)
- table.attach(h, 3, 4, row, row + 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)
+ table.attach(h, 3, 4, row, row + 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 0, 0, 0)
row += 1
return vbox
def process_events(self):
"""Process pending gtk events"""
- while gtk.events_pending():
- gtk.main_iteration(False)
+ while Gtk.events_pending():
+ Gtk.main_iteration(False)
def show_test_results(self, widget, logfile):
"""Shows results of last periodic check"""
@@ -688,59 +688,59 @@ class MsecGui:
data = fd.readlines()
except:
data = [_("Unable to read log file: %s") % sys.exc_value]
- dialog = gtk.Dialog(_("Periodic check results"),
+ dialog = Gtk.Dialog(_("Periodic check results"),
self.window,
0,
- (gtk.STOCK_OK, gtk.RESPONSE_OK))
+ (Gtk.STOCK_OK, Gtk.ResponseType.OK))
dialog.set_size_request(640, 280)
- view = gtk.TextView()
+ view = Gtk.TextView()
buffer = view.get_buffer()
buffer.create_tag("monospace", family="monospace", editable=False)
iter = buffer.get_iter_at_offset(0)
for l in data:
buffer.insert_with_tags_by_name(iter, l, "monospace")
- sw = gtk.ScrolledWindow()
- sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
- sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+ sw = Gtk.ScrolledWindow()
+ sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
+ sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
sw.add(view)
- dialog.vbox.pack_start(sw)
+ dialog.vbox.pack_start(sw, True, True, 0)
dialog.show_all()
ret = dialog.run()
dialog.destroy()
- if ret != gtk.RESPONSE_YES:
+ if ret != Gtk.ResponseType.YES:
return
pass
def run_periodic_check(self, widget, check):
"""Shows results for the test"""
- dialog = gtk.MessageDialog(
+ dialog = Gtk.MessageDialog(
parent=self.window,
flags=0,
- type=gtk.MESSAGE_INFO,
- buttons=gtk.BUTTONS_YES_NO)
+ type=Gtk.MessageType.INFO,
+ buttons=Gtk.ButtonsType.YES_NO)
dialog.set_markup(_("Do you want to run the <b>%s</b> periodic check? Please note that it could take a considerable time to finish.") % check)
dialog.show_all()
ret = dialog.run()
dialog.destroy()
- if ret != gtk.RESPONSE_YES:
+ if ret != Gtk.ResponseType.YES:
return
# progress bar
- progress = gtk.Window()
+ progress = Gtk.Window()
progress.set_title(_("Please wait, running checks..."))
progress.set_transient_for(self.window)
progress.set_modal(True)
progress.connect('delete-event', lambda *w: None)
- vbox = gtk.VBox(spacing=10)
+ vbox = Gtk.VBox(spacing=10)
progress.add(vbox)
- progressbar = gtk.ProgressBar()
+ progressbar = Gtk.ProgressBar()
progressbar.set_text(_("Please wait, running checks..."))
- vbox.pack_start(progressbar)
+ vbox.pack_start(progressbar, True, True, 0)
- label = gtk.Label(_("Please wait, this might take a few minutes."))
- vbox.pack_start(label)
+ label = Gtk.Label(_("Please wait, this might take a few minutes."))
+ vbox.pack_start(label, True, True, 0)
# show window
progress.show_all()
@@ -769,17 +769,17 @@ class MsecGui:
if result == 0:
text = _("Periodic check was executed successfully!")
- type = gtk.MESSAGE_INFO
+ type = Gtk.MessageType.INFO
else:
text = _("An error occurred while running periodic check.")
- type = gtk.MESSAGE_ERROR
+ type = Gtk.MessageType.ERROR
# policy was initialized
- dialog = gtk.MessageDialog(
+ dialog = Gtk.MessageDialog(
parent=self.window,
flags=0,
type=type,
message_format=text,
- buttons=gtk.BUTTONS_OK
+ buttons=Gtk.ButtonsType.OK
)
dialog.show_all()
dialog.run()
@@ -796,53 +796,53 @@ class MsecGui:
def level_security_page(self, id):
"""Builds the basic security page"""
- vbox = gtk.VBox(homogeneous=False)
+ vbox = Gtk.VBox(homogeneous=False)
- entry = gtk.Label(LEVEL_SECURITY_TEXT)
+ entry = Gtk.Label(label=LEVEL_SECURITY_TEXT)
entry.set_use_markup(True)
vbox.pack_start(entry, False, False)
# none
- self.msec_enabled = gtk.CheckButton(label=_("Enable MSEC tool"))
+ self.msec_enabled = Gtk.CheckButton(label=_("Enable MSEC tool"))
if self.base_level != config.NONE_LEVEL:
self.msec_enabled.set_active(True)
self.msec_enabled.connect('clicked', self.enable_disable_msec)
vbox.pack_start(self.msec_enabled, False, False)
# security levels
- self.levels_frame = gtk.Frame(_("Select the base security level"))
- levels_vbox = gtk.VBox(homogeneous=False)
+ self.levels_frame = Gtk.Frame(_("Select the base security level"))
+ levels_vbox = Gtk.VBox(homogeneous=False)
self.levels_frame.add(levels_vbox)
# create the security level selection screen
- sw = gtk.ScrolledWindow()
- sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
- sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
+ sw = Gtk.ScrolledWindow()
+ sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
+ sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
# list of levels
- lstore = gtk.ListStore(
- gobject.TYPE_STRING,
- gobject.TYPE_STRING,
- gobject.TYPE_INT)
+ lstore = Gtk.ListStore(
+ GObject.TYPE_STRING,
+ GObject.TYPE_STRING,
+ GObject.TYPE_INT)
# treeview
- treeview = gtk.TreeView(lstore)
+ treeview = Gtk.TreeView(lstore)
treeview.set_rules_hint(True)
treeview.set_search_column(self.COLUMN_LEVEL_DESCR)
treeview.connect('row-activated', self.level_changed, lstore)
# columns
# column for level names
- renderer = gtk.CellRendererText()
- column = gtk.TreeViewColumn(_('Level name'), renderer, text=self.COLUMN_OPTION, weight=self.COLUMN_LEVEL_CURRENT)
+ renderer = Gtk.CellRendererText()
+ column = Gtk.TreeViewColumn(_('Level name'), renderer, text=self.COLUMN_OPTION, weight=self.COLUMN_LEVEL_CURRENT)
column.set_sort_column_id(self.COLUMN_LEVEL)
column.set_resizable(True)
column.set_expand(False)
treeview.append_column(column)
# column for descriptions
- renderer = gtk.CellRendererText()
+ renderer = Gtk.CellRendererText()
renderer.set_property('wrap-width', 600)
- renderer.set_property('wrap-mode', pango.WRAP_WORD_CHAR)
+ renderer.set_property('wrap-mode', Pango.WrapMode.WORD_CHAR)
column = treeview.insert_column_with_attributes(-1, _('Description'), renderer, text=self.COLUMN_DESCR, weight=self.COLUMN_LEVEL_CURRENT)
column.set_expand(True)
#treeview.append_column(column)
@@ -871,16 +871,16 @@ class MsecGui:
# TODO: mark current level as bold
iter = lstore.append()
if self.base_level == level:
- weight = pango.WEIGHT_BOLD
+ weight = Pango.Weight.BOLD
else:
- weight = pango.WEIGHT_NORMAL
+ weight = Pango.Weight.NORMAL
lstore.set(iter,
self.COLUMN_LEVEL, level,
self.COLUMN_LEVEL_DESCR, descr,
self.COLUMN_LEVEL_CURRENT, weight)
- levels_vbox.pack_start(sw)
- vbox.pack_start(self.levels_frame)
+ levels_vbox.pack_start(sw, True, True, 0)
+ vbox.pack_start(self.levels_frame, True, True, 0)
# save the list of levels
self.level_list = lstore
@@ -888,14 +888,14 @@ class MsecGui:
# putting levels to vbox
# notifications by email
- hbox = gtk.HBox()
- self.notify_mail = gtk.CheckButton(_("Send security alerts by email to:"))
+ hbox = Gtk.HBox()
+ self.notify_mail = Gtk.CheckButton(_("Send security alerts by email to:"))
if self.msecconfig.get("MAIL_WARN") == "yes":
self.notify_mail.set_active(True)
hbox.pack_start(self.notify_mail, False, False)
# email address
- self.email_entry = gtk.Entry()
+ self.email_entry = Gtk.Entry()
email = self.msecconfig.get("MAIL_USER")
if not email:
email = ""
@@ -911,7 +911,7 @@ class MsecGui:
self.notify_mail_changed(self.notify_mail, hbox)
# notifications on desktop
- self.notify_desktop = gtk.CheckButton(_("Display security alerts on desktop"))
+ self.notify_desktop = Gtk.CheckButton(_("Display security alerts on desktop"))
if self.msecconfig.get("NOTIFY_WARN") == "yes":
self.notify_desktop.set_active(True)
self.notify_desktop.connect('clicked', self.notify_changed, None)
@@ -956,7 +956,7 @@ class MsecGui:
while iter:
list_level = self.level_list.get_value(iter, self.COLUMN_LEVEL)
list_weight = self.level_list.get_value(iter, self.COLUMN_LEVEL_CURRENT)
- if list_weight == pango.WEIGHT_BOLD:
+ if list_weight == Pango.Weight.BOLD:
# found previous level
level = list_level
break
@@ -994,11 +994,11 @@ class MsecGui:
if list_level != level:
# not current level, changing font weight
self.level_list.set(iter,
- self.COLUMN_LEVEL_CURRENT, pango.WEIGHT_NORMAL)
+ self.COLUMN_LEVEL_CURRENT, Pango.Weight.NORMAL)
else:
# updating current level
self.level_list.set(iter,
- self.COLUMN_LEVEL_CURRENT, pango.WEIGHT_BOLD)
+ self.COLUMN_LEVEL_CURRENT, Pango.Weight.BOLD)
iter = self.level_list.iter_next(iter)
# what is the current level?
@@ -1022,7 +1022,7 @@ class MsecGui:
# reset customization
curconfig.set(option, newvalue)
# set option as normal
- options.set(iter, self.COLUMN_CUSTOM, pango.WEIGHT_NORMAL)
+ options.set(iter, self.COLUMN_CUSTOM, Pango.Weight.NORMAL)
## skip custom options
#print "Base level: %s" % self.base_level
#if self.option_is_changed(option, curvalue):
@@ -1057,52 +1057,52 @@ class MsecGui:
def system_security_page(self, id):
"""Builds the network security page"""
- vbox = gtk.VBox(homogeneous=False)
+ vbox = Gtk.VBox(homogeneous=False)
- entry = gtk.Label(SYSTEM_SECURITY_TEXT)
+ entry = Gtk.Label(label=SYSTEM_SECURITY_TEXT)
entry.set_use_markup(True)
vbox.pack_start(entry, False, False)
# system security options
options_view, model = self.create_treeview(config.SETTINGS_SYSTEM)
self.current_options_view[id] = (model, self.msecconfig)
- vbox.pack_start(options_view)
+ vbox.pack_start(options_view, True, True, 0)
return vbox
def network_security_page(self, id):
"""Builds the network security page"""
- vbox = gtk.VBox(homogeneous=False)
+ vbox = Gtk.VBox(homogeneous=False)
- entry = gtk.Label(NETWORK_SECURITY_TEXT)
+ entry = Gtk.Label(label=NETWORK_SECURITY_TEXT)
entry.set_use_markup(True)
vbox.pack_start(entry, False, False)
# network security options
options_view, model = self.create_treeview(config.SETTINGS_NETWORK)
self.current_options_view[id] = (model, self.msecconfig)
- vbox.pack_start(options_view)
+ vbox.pack_start(options_view, True, True, 0)
return vbox
def periodic_security_page(self, id):
"""Builds the network security page"""
- vbox = gtk.VBox(homogeneous=False)
+ vbox = Gtk.VBox(homogeneous=False)
- entry = gtk.Label(PERIODIC_SECURITY_TEXT)
+ entry = Gtk.Label(label=PERIODIC_SECURITY_TEXT)
entry.set_use_markup(True)
vbox.pack_start(entry, False, False)
periodic_checks = self.msecconfig.get("CHECK_SECURITY")
- self.periodic_checks = gtk.CheckButton(_("Enable periodic security checks"))
+ self.periodic_checks = Gtk.CheckButton(_("Enable periodic security checks"))
if periodic_checks == "yes":
self.periodic_checks.set_active(True)
vbox.pack_start(self.periodic_checks, False, False)
# network security options
options_view, model = self.create_treeview(config.SETTINGS_PERIODIC)
- vbox.pack_start(options_view)
+ vbox.pack_start(options_view, True, True, 0)
# see if these tests are enabled
self.periodic_checks.connect('clicked', self.periodic_tests, options_view)
@@ -1130,24 +1130,24 @@ class MsecGui:
def exceptions_page(self, id):
"""Builds the exceptions page"""
- vbox = gtk.VBox(homogeneous=False)
+ vbox = Gtk.VBox(homogeneous=False)
- entry = gtk.Label(EXCEPTIONS_TEXT)
+ entry = Gtk.Label(label=EXCEPTIONS_TEXT)
entry.set_use_markup(True)
vbox.pack_start(entry, False, False)
- sw = gtk.ScrolledWindow()
- sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
- sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
+ sw = Gtk.ScrolledWindow()
+ sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
+ sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
# list of options
- lstore = gtk.ListStore(
- gobject.TYPE_STRING,
- gobject.TYPE_STRING
+ lstore = Gtk.ListStore(
+ GObject.TYPE_STRING,
+ GObject.TYPE_STRING
)
# treeview
- treeview = gtk.TreeView(lstore)
+ treeview = Gtk.TreeView(lstore)
treeview.set_rules_hint(True)
treeview.set_search_column(self.COLUMN_EXCEPTION)
@@ -1157,13 +1157,13 @@ class MsecGui:
# configuring columns
# column for exception position
- column = gtk.TreeViewColumn(_('Security check'), gtk.CellRendererText(), text=self.COLUMN_EXCEPTION)
+ column = Gtk.TreeViewColumn(_('Security check'), Gtk.CellRendererText(), text=self.COLUMN_EXCEPTION)
column.set_sort_column_id(self.COLUMN_EXCEPTION)
column.set_expand(True)
treeview.append_column(column)
# column for check exception
- column = gtk.TreeViewColumn(_('Exception'), gtk.CellRendererText(), text=self.COLUMN_EXCEPTION_VALUE)
+ column = Gtk.TreeViewColumn(_('Exception'), Gtk.CellRendererText(), text=self.COLUMN_EXCEPTION_VALUE)
column.set_sort_column_id(self.COLUMN_EXCEPTION_VALUE)
column.set_expand(True)
treeview.append_column(column)
@@ -1177,19 +1177,19 @@ class MsecGui:
self.COLUMN_EXCEPTION, option,
self.COLUMN_EXCEPTION_VALUE, value,
)
- vbox.pack_start(sw)
+ vbox.pack_start(sw, True, True, 0)
self.current_options_view[id] = (lstore, self.exceptions)
# buttons hbox
- hbox = gtk.HBox(homogeneous=True, spacing=10)
+ hbox = Gtk.HBox(homogeneous=True, spacing=10)
# add
- button = gtk.Button(_("Add a rule"))
+ button = Gtk.Button(_("Add a rule"))
button.connect('clicked', self.add_exception, lstore)
hbox.pack_start(button, False)
# delete
- button = gtk.Button(_("Delete"))
+ button = Gtk.Button(_("Delete"))
button.connect('clicked', self.remove_exception, treeview)
hbox.pack_start(button, False)
@@ -1199,27 +1199,27 @@ class MsecGui:
def permissions_security_page(self, id):
"""Builds the network security page"""
- vbox = gtk.VBox(homogeneous=False)
+ vbox = Gtk.VBox(homogeneous=False)
- entry = gtk.Label(PERMISSIONS_SECURITY_TEXT)
+ entry = Gtk.Label(label=PERMISSIONS_SECURITY_TEXT)
entry.set_use_markup(True)
vbox.pack_start(entry, False, False)
- sw = gtk.ScrolledWindow()
- sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
- sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
+ sw = Gtk.ScrolledWindow()
+ sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
+ sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
# list of options
- lstore = gtk.ListStore(
- gobject.TYPE_STRING,
- gobject.TYPE_STRING,
- gobject.TYPE_STRING,
- gobject.TYPE_STRING,
- gobject.TYPE_BOOLEAN,
- gobject.TYPE_STRING)
+ lstore = Gtk.ListStore(
+ GObject.TYPE_STRING,
+ GObject.TYPE_STRING,
+ GObject.TYPE_STRING,
+ GObject.TYPE_STRING,
+ GObject.TYPE_BOOLEAN,
+ GObject.TYPE_STRING)
# treeview
- treeview = gtk.TreeView(lstore)
+ treeview = Gtk.TreeView(lstore)
treeview.set_rules_hint(True)
treeview.set_search_column(self.COLUMN_DESCR)
@@ -1229,41 +1229,41 @@ class MsecGui:
# configuring columns
# column for path mask
- column = gtk.TreeViewColumn(_('Path'), gtk.CellRendererText(), text=self.COLUMN_PATH)
+ column = Gtk.TreeViewColumn(_('Path'), Gtk.CellRendererText(), text=self.COLUMN_PATH)
column.set_sort_column_id(self.COLUMN_PATH)
column.set_expand(True)
treeview.append_column(column)
# column for user
- column = gtk.TreeViewColumn(_('User'), gtk.CellRendererText(), text=self.COLUMN_USER)
+ column = Gtk.TreeViewColumn(_('User'), Gtk.CellRendererText(), text=self.COLUMN_USER)
column.set_sort_column_id(self.COLUMN_USER)
column.set_expand(True)
treeview.append_column(column)
# column for group
- column = gtk.TreeViewColumn(_('Group'), gtk.CellRendererText(), text=self.COLUMN_GROUP)
+ column = Gtk.TreeViewColumn(_('Group'), Gtk.CellRendererText(), text=self.COLUMN_GROUP)
column.set_sort_column_id(self.COLUMN_GROUP)
column.set_expand(True)
treeview.append_column(column)
# column for permissions
- column = gtk.TreeViewColumn(_('Permissions'), gtk.CellRendererText(), text=self.COLUMN_PERM)
+ column = Gtk.TreeViewColumn(_('Permissions'), Gtk.CellRendererText(), text=self.COLUMN_PERM)
column.set_sort_column_id(self.COLUMN_VALUE)
column.set_expand(True)
treeview.append_column(column)
# column for force option
- renderer = gtk.CellRendererToggle()
+ renderer = Gtk.CellRendererToggle()
renderer.connect('toggled', self.toggle_enforced, lstore)
- column = gtk.TreeViewColumn(_('Enforce'), renderer, active=self.COLUMN_FORCE)
+ column = Gtk.TreeViewColumn(_('Enforce'), renderer, active=self.COLUMN_FORCE)
column.set_sort_column_id(self.COLUMN_FORCE)
- column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
+ column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
column.set_fixed_width(50)
column.set_expand(True)
treeview.append_column(column)
# column for Acl
- column = gtk.TreeViewColumn(_('Acl'), gtk.CellRendererText(), text=self.COLUMN_ACL)
+ column = Gtk.TreeViewColumn(_('Acl'), Gtk.CellRendererText(), text=self.COLUMN_ACL)
column.set_sort_column_id(self.COLUMN_ACL)
column.set_expand(True)
treeview.append_column(column)
@@ -1289,39 +1289,39 @@ class MsecGui:
self.COLUMN_FORCE, force,
self.COLUMN_ACL, acl,
)
- vbox.pack_start(sw)
+ vbox.pack_start(sw, True, True, 0)
self.current_options_view[id] = (lstore, self.permconfig)
# buttons hbox
- hbox = gtk.HBox(homogeneous=True, spacing=10)
+ hbox = Gtk.HBox(homogeneous=True, spacing=10)
# # up
- # button = gtk.Button(_("Up"))
+ # button = Gtk.Button(_("Up"))
# button.connect('clicked', self.move_rule_up, lstore)
# hbox.pack_start(button, False)
# # down
- # button = gtk.Button(_("Down"))
+ # button = Gtk.Button(_("Down"))
# button.connect('clicked', self.move_rule_up, lstore)
# hbox.pack_start(button, False)
# # default
- # button = gtk.Button(_("Reset to default level permissions"))
+ # button = Gtk.Button(_("Reset to default level permissions"))
# button.connect('clicked', self.reset_permissions, lstore)
# hbox.pack_start(button, False)
# add
- button = gtk.Button(_("Add a rule"))
+ button = Gtk.Button(_("Add a rule"))
button.connect('clicked', self.add_permission_check, lstore)
hbox.pack_start(button, False)
# delete
- button = gtk.Button(_("Delete"))
+ button = Gtk.Button(_("Delete"))
button.connect('clicked', self.remove_permission_check, treeview)
hbox.pack_start(button, False)
## edit
- #button = gtk.Button(_("Edit"))
+ #button = Gtk.Button(_("Edit"))
#button.connect('clicked', self.move_rule_up, lstore)
#hbox.pack_start(button, False)
@@ -1424,19 +1424,19 @@ class MsecGui:
title = _("Adding new exception")
# asks for new parameter value
- dialog = gtk.Dialog(title,
+ dialog = Gtk.Dialog(title,
self.window, 0,
- (gtk.STOCK_OK, gtk.RESPONSE_OK,
- gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
- label = gtk.Label(_("Editing exception. Please select the correspondent msec check and exception value\n"))
+ (Gtk.STOCK_OK, Gtk.ResponseType.OK,
+ Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
+ label = Gtk.Label(label=_("Editing exception. Please select the correspondent msec check and exception value\n"))
label.set_line_wrap(True)
label.set_use_markup(True)
dialog.vbox.pack_start(label, False, False)
# module
- hbox = gtk.HBox()
- hbox.pack_start(gtk.Label(_("Check: ")))
- entry_module = gtk.combo_box_new_text()
+ hbox = Gtk.HBox()
+ hbox.pack_start(Gtk.Label(_("Check: ", True, True, 0)))
+ entry_module = Gtk.ComboBoxText()
pos = 0
for item in config.CHECKS_WITH_EXCEPTIONS:
entry_module.append_text(item)
@@ -1445,20 +1445,20 @@ class MsecGui:
pos += 1
if not module:
entry_module.set_active(0)
- hbox.pack_start(entry_module)
+ hbox.pack_start(entry_module, True, True, 0)
dialog.vbox.pack_start(hbox, False, False)
# exception
- hbox = gtk.HBox()
- hbox.pack_start(gtk.Label(_("Exception: ")))
- entry_exception = gtk.Entry()
+ hbox = Gtk.HBox()
+ hbox.pack_start(Gtk.Label(_("Exception: ", True, True, 0)))
+ entry_exception = Gtk.Entry()
entry_exception.set_text(exception)
- hbox.pack_start(entry_exception)
+ hbox.pack_start(entry_exception, True, True, 0)
dialog.vbox.pack_start(hbox, False, False)
dialog.show_all()
response = dialog.run()
- if response != gtk.RESPONSE_OK:
+ if response != Gtk.ResponseType.OK:
dialog.destroy()
return
@@ -1502,88 +1502,88 @@ class MsecGui:
force = "force"
# asks for new parameter value
- dialog = gtk.Dialog(title,
+ dialog = Gtk.Dialog(title,
self.window, 0,
- (gtk.STOCK_OK, gtk.RESPONSE_OK,
- gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
- label = gtk.Label(_("Changing permissions on <b>%s</b>") % (file or _("new file")))
+ (Gtk.STOCK_OK, Gtk.ResponseType.OK,
+ Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
+ label = Gtk.Label(label=_("Changing permissions on <b>%s</b>") % (file or _("new file")))
label.set_line_wrap(True)
label.set_use_markup(True)
dialog.vbox.pack_start(label, False, False, padding=5)
# aligning entries
- sizegroup1 = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
- sizegroup2 = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
+ sizegroup1 = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
+ sizegroup2 = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
if not path:
# file
- hbox = gtk.HBox()
- label = gtk.Label(_("File: "))
- hbox.pack_start(label)
- entry_file = gtk.Entry()
+ hbox = Gtk.HBox()
+ label = Gtk.Label(label=_("File: "))
+ hbox.pack_start(label, True, True, 0)
+ entry_file = Gtk.Entry()
entry_file.set_text(file)
- hbox.pack_start(entry_file)
+ hbox.pack_start(entry_file, True, True, 0)
sizegroup1.add_widget(label)
sizegroup2.add_widget(entry_file)
dialog.vbox.pack_start(hbox, False, False)
- label = gtk.Label(_("Please specify new file owner and permissions, or use 'current' to keep current settings."))
+ label = Gtk.Label(_("Please specify new file owner and permissions, or use 'current' to keep current settings."))
label.set_line_wrap(True)
label.set_use_markup(True)
dialog.vbox.pack_start(label, False, False, padding=5)
# user
- hbox = gtk.HBox()
- label = gtk.Label(_("User: "))
- hbox.pack_start(label)
- entry_user = gtk.Entry()
+ hbox = Gtk.HBox()
+ label = Gtk.Label(label=_("User: "))
+ hbox.pack_start(label, True, True, 0)
+ entry_user = Gtk.Entry()
entry_user.set_text(user)
- hbox.pack_start(entry_user)
+ hbox.pack_start(entry_user, True, True, 0)
sizegroup1.add_widget(label)
sizegroup2.add_widget(entry_user)
dialog.vbox.pack_start(hbox, False, False)
# group
- hbox = gtk.HBox()
- label = gtk.Label(_("Group: "))
- hbox.pack_start(label)
- entry_group = gtk.Entry()
+ hbox = Gtk.HBox()
+ label = Gtk.Label(label=_("Group: "))
+ hbox.pack_start(label, True, True, 0)
+ entry_group = Gtk.Entry()
entry_group.set_text(group)
- hbox.pack_start(entry_group)
+ hbox.pack_start(entry_group, True, True, 0)
sizegroup1.add_widget(label)
sizegroup2.add_widget(entry_group)
dialog.vbox.pack_start(hbox, False, False)
# perm
- hbox = gtk.HBox()
- label = gtk.Label(_("Permissions: "))
- hbox.pack_start(label)
- entry_perm = gtk.Entry()
+ hbox = Gtk.HBox()
+ label = Gtk.Label(label=_("Permissions: "))
+ hbox.pack_start(label, True, True, 0)
+ entry_perm = Gtk.Entry()
entry_perm.set_text(perm)
- hbox.pack_start(entry_perm)
+ hbox.pack_start(entry_perm, True, True, 0)
sizegroup1.add_widget(label)
sizegroup2.add_widget(entry_perm)
dialog.vbox.pack_start(hbox, False, False)
- label = gtk.Label(_("To enforce additional ACL (Access Control List) on file, specify them in the following format:\nuser1:acl,user2:acl\nRefer to 'man setfacl' for details."))
+ label = Gtk.Label(label=_("To enforce additional ACL (Access Control List) on file, specify them in the following format:\nuser1:acl,user2:acl\nRefer to 'man setfacl' for details."))
label.set_line_wrap(True)
label.set_use_markup(True)
dialog.vbox.pack_start(label, False, False, padding=5)
# acl
- hbox = gtk.HBox()
- label = gtk.Label(_("ACL: "))
- hbox.pack_start(label)
- entry_acl = gtk.Entry()
+ hbox = Gtk.HBox()
+ label = Gtk.Label(label=_("ACL: "))
+ hbox.pack_start(label, True, True, 0)
+ entry_acl = Gtk.Entry()
entry_acl.set_text(acl)
- hbox.pack_start(entry_acl)
+ hbox.pack_start(entry_acl, True, True, 0)
sizegroup1.add_widget(label)
sizegroup2.add_widget(entry_acl)
dialog.vbox.pack_start(hbox, False, False)
dialog.show_all()
response = dialog.run()
- if response != gtk.RESPONSE_OK:
+ if response != Gtk.ResponseType.OK:
dialog.destroy()
return
@@ -1639,33 +1639,33 @@ class MsecGui:
val_def = conf_def.get(param)
# asks for new parameter value
- dialog = gtk.Dialog(_("Select new value for %s") % (param),
+ dialog = Gtk.Dialog(_("Select new value for %s") % (param),
self.window, 0,
- (gtk.STOCK_OK, gtk.RESPONSE_OK,
- gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
+ (Gtk.STOCK_OK, Gtk.ResponseType.OK,
+ Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
# option title
- label = gtk.Label("<b>%s</b>\n" % param)
+ label = Gtk.Label(label="<b>%s</b>\n" % param)
label.set_use_markup(True)
# description
- dialog.vbox.pack_start(label)
- label = gtk.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") %
+ 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,))
label.set_line_wrap(True)
label.set_use_markup(True)
- dialog.vbox.pack_start(label)
- dialog.vbox.pack_start(gtk.HSeparator())
+ dialog.vbox.pack_start(label, True, True, 0)
+ dialog.vbox.pack_start(Gtk.HSeparator(, True, True, 0))
# new value
- hbox = gtk.HBox()
- hbox.pack_start(gtk.Label(_("New value:")))
+ hbox = Gtk.HBox()
+ hbox.pack_start(Gtk.Label(_("New value:", True, True, 0)))
if '*' in params:
# string parameter
- entry = gtk.Entry()
+ entry = Gtk.Entry()
entry.set_text(value)
else:
# combobox parameter
- entry = gtk.combo_box_new_text()
+ entry = Gtk.ComboBoxText()
# add an item to disable a check
if config.OPTION_DISABLED not in params:
params.append(config.OPTION_DISABLED)
@@ -1676,12 +1676,12 @@ class MsecGui:
params.append(value)
active = params.index(value)
entry.set_active(active)
- hbox.pack_start(entry)
- dialog.vbox.pack_start(hbox)
+ hbox.pack_start(entry, True, True, 0)
+ dialog.vbox.pack_start(hbox, True, True, 0)
dialog.show_all()
response = dialog.run()
- if response != gtk.RESPONSE_OK:
+ if response != Gtk.ResponseType.OK:
dialog.destroy()
return
@@ -1698,9 +1698,9 @@ class MsecGui:
# is it different from default? if yes, change description to italic
doc = config.find_doc(self.msec, param, self.descriptions)
if self.option_is_changed(param, newval):
- custom = pango.WEIGHT_BOLD
+ custom = Pango.Weight.BOLD
else:
- custom = pango.WEIGHT_NORMAL
+ custom = Pango.Weight.NORMAL
model.set(iter, self.COLUMN_VALUE, newval)
model.set(iter, self.COLUMN_DESCR, doc)
@@ -1716,12 +1716,12 @@ class MsecGui:
num_changes, allchanges, messages = self.check_for_changes(self.msecconfig, self.permconfig)
if num_changes == 0:
- gtk.main_quit()
+ Gtk.main_quit()
return False
else:
ret = self.ok(widget, ask_ignore=True)
- if ret == gtk.RESPONSE_OK or ret == gtk.RESPONSE_REJECT:
- gtk.main_quit()
+ if ret == Gtk.ResponseType.OK or ret == Gtk.ResponseType.REJECT:
+ Gtk.main_quit()
else:
return True
@@ -1783,5 +1783,5 @@ if __name__ == "__main__":
gui = MsecGui(log, msec, perms, msec_config, perm_conf, exceptions, embed=PlugWindowID)
signal.signal(signal.SIGTERM, lambda s, f: gui.signal_quit(s))
- gtk.main()
+ Gtk.main()