a slight pylint improvement (to _guioptions.py)

This commit is contained in:
Paul Franklin 2016-06-16 10:43:33 -07:00
parent 7fb8b0f155
commit 20fac5cc53

View File

@ -34,7 +34,6 @@ Specific option handling for a GUI.
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import os import os
import sys
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -98,7 +97,8 @@ class LastNameDialog(ManagedWindow):
self.__tree_view.append_column(col2) self.__tree_view.append_column(col2)
scrolled_window = Gtk.ScrolledWindow() scrolled_window = Gtk.ScrolledWindow()
scrolled_window.add(self.__tree_view) scrolled_window.add(self.__tree_view)
scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC,
Gtk.PolicyType.AUTOMATIC)
scrolled_window.set_shadow_type(Gtk.ShadowType.OUT) scrolled_window.set_shadow_type(Gtk.ShadowType.OUT)
self.__dlg.vbox.pack_start(scrolled_window, True, True, 0) self.__dlg.vbox.pack_start(scrolled_window, True, True, 0)
scrolled_window.show_all() scrolled_window.show_all()
@ -149,8 +149,8 @@ class LastNameDialog(ManagedWindow):
if response == Gtk.ResponseType.ACCEPT: if response == Gtk.ResponseType.ACCEPT:
(mode, paths) = self.__tree_selection.get_selected_rows() (mode, paths) = self.__tree_selection.get_selected_rows()
for path in paths: for path in paths:
i = self.__model.get_iter(path) iii = self.__model.get_iter(path)
surname = self.__model.get_value(i, 0) surname = self.__model.get_value(iii, 0)
surname_set.add(surname) surname_set.add(surname)
self.__dlg.destroy() self.__dlg.destroy()
return surname_set return surname_set
@ -179,9 +179,11 @@ class GuiStringOption(Gtk.Entry):
# a specific signal, we need to temporarily block the signal # a specific signal, we need to temporarily block the signal
# that would call the other signal handler. # that would call the other signal handler.
self.changekey = self.connect('changed', self.__text_changed) self.changekey = self.connect('changed', self.__text_changed)
self.valuekey = self.__option.connect('value-changed', self.__value_changed) self.valuekey = self.__option.connect('value-changed',
self.__value_changed)
self.conkey = self.__option.connect('avail-changed', self.__update_avail) self.conkey = self.__option.connect('avail-changed',
self.__update_avail)
self.__update_avail() self.__update_avail()
self.set_tooltip_text(self.__option.get_help()) self.set_tooltip_text(self.__option.get_help())
@ -228,7 +230,6 @@ class GuiColorOption(Gtk.ColorButton):
""" """
def __init__(self, option, dbstate, uistate, track, override): def __init__(self, option, dbstate, uistate, track, override):
self.__option = option self.__option = option
value = self.__option.get_value()
Gtk.ColorButton.__init__(self) Gtk.ColorButton.__init__(self)
rgba = Gdk.RGBA() rgba = Gdk.RGBA()
rgba.parse(self.__option.get_value()) rgba.parse(self.__option.get_value())
@ -239,9 +240,11 @@ class GuiColorOption(Gtk.ColorButton):
# a specific signal, we need to temporarily block the signal # a specific signal, we need to temporarily block the signal
# that would call the other signal handler. # that would call the other signal handler.
self.changekey = self.connect('color-set', self.__color_changed) self.changekey = self.connect('color-set', self.__color_changed)
self.valuekey = self.__option.connect('value-changed', self.__value_changed) self.valuekey = self.__option.connect('value-changed',
self.__value_changed)
self.conkey = self.__option.connect('avail-changed', self.__update_avail) self.conkey = self.__option.connect('avail-changed',
self.__update_avail)
self.__update_avail() self.__update_avail()
self.set_tooltip_text(self.__option.get_help()) self.set_tooltip_text(self.__option.get_help())
@ -309,7 +312,8 @@ class GuiNumberOption(Gtk.SpinButton):
import math import math
decimals = int(math.log10(step) * -1) decimals = int(math.log10(step) * -1)
Gtk.SpinButton.__init__(self, adjustment=adj, climb_rate=1, digits=decimals) Gtk.SpinButton.__init__(self, adjustment=adj,
climb_rate=1, digits=decimals)
Gtk.SpinButton.set_numeric(self, True) Gtk.SpinButton.set_numeric(self, True)
self.set_value(self.__option.get_value()) self.set_value(self.__option.get_value())
@ -318,10 +322,13 @@ class GuiNumberOption(Gtk.SpinButton):
# from user interaction or programmatically. When handling # from user interaction or programmatically. When handling
# a specific signal, we need to temporarily block the signal # a specific signal, we need to temporarily block the signal
# that would call the other signal handler. # that would call the other signal handler.
self.changekey = self.connect('value_changed', self.__number_changed) self.changekey = self.connect('value_changed',
self.valuekey = self.__option.connect('value-changed', self.__value_changed) self.__number_changed)
self.valuekey = self.__option.connect('value-changed',
self.__value_changed)
self.conkey = self.__option.connect('avail-changed', self.__update_avail) self.conkey = self.__option.connect('avail-changed',
self.__update_avail)
self.__update_avail() self.__update_avail()
self.set_tooltip_text(self.__option.get_help()) self.set_tooltip_text(self.__option.get_help())
@ -388,7 +395,8 @@ class GuiTextOption(Gtk.ScrolledWindow):
# a specific signal, we need to temporarily block the signal # a specific signal, we need to temporarily block the signal
# that would call the other signal handler. # that would call the other signal handler.
self.bufcon = self.__buff.connect('changed', self.__text_changed) self.bufcon = self.__buff.connect('changed', self.__text_changed)
self.valuekey = self.__option.connect('value-changed', self.__value_changed) self.valuekey = self.__option.connect('value-changed',
self.__value_changed)
# Required for tooltip # Required for tooltip
gtext.add_events(Gdk.EventMask.ENTER_NOTIFY_MASK) gtext.add_events(Gdk.EventMask.ENTER_NOTIFY_MASK)
@ -462,9 +470,11 @@ class GuiBooleanOption(Gtk.CheckButton):
# a specific signal, we need to temporarily block the signal # a specific signal, we need to temporarily block the signal
# that would call the other signal handler. # that would call the other signal handler.
self.changekey = self.connect('toggled', self.__state_changed) self.changekey = self.connect('toggled', self.__state_changed)
self.valuekey = self.__option.connect('value-changed', self.__value_changed) self.valuekey = self.__option.connect('value-changed',
self.__value_changed)
self.conkey = self.__option.connect('avail-changed', self.__update_avail) self.conkey = self.__option.connect('avail-changed',
self.__update_avail)
self.__update_avail() self.__update_avail()
self.set_tooltip_text(self.__option.get_help()) self.set_tooltip_text(self.__option.get_help())
@ -510,14 +520,14 @@ class GuiEnumeratedListOption(Gtk.Box):
""" """
def __init__(self, option, dbstate, uistate, track, override): def __init__(self, option, dbstate, uistate, track, override):
Gtk.Box.__init__(self) Gtk.Box.__init__(self)
evtBox = Gtk.EventBox() evt_box = Gtk.EventBox()
self.__option = option self.__option = option
self.__combo = Gtk.ComboBoxText() self.__combo = Gtk.ComboBoxText()
if len(option.get_items()) > 18: if len(option.get_items()) > 18:
self.__combo.set_popup_fixed_width(False) self.__combo.set_popup_fixed_width(False)
self.__combo.set_wrap_width(3) self.__combo.set_wrap_width(3)
evtBox.add(self.__combo) evt_box.add(self.__combo)
self.pack_start(evtBox, True, True, 0) self.pack_start(evt_box, True, True, 0)
self.__update_options() self.__update_options()
@ -525,11 +535,15 @@ class GuiEnumeratedListOption(Gtk.Box):
# from user interaction or programmatically. When handling # from user interaction or programmatically. When handling
# a specific signal, we need to temporarily block the signal # a specific signal, we need to temporarily block the signal
# that would call the other signal handler. # that would call the other signal handler.
self.changekey = self.__combo.connect('changed', self.__selection_changed) self.changekey = self.__combo.connect('changed',
self.valuekey = self.__option.connect('value-changed', self.__value_changed) self.__selection_changed)
self.valuekey = self.__option.connect('value-changed',
self.__value_changed)
self.conkey1 = self.__option.connect('options-changed', self.__update_options) self.conkey1 = self.__option.connect('options-changed',
self.conkey2 = self.__option.connect('avail-changed', self.__update_avail) self.__update_options)
self.conkey2 = self.__option.connect('avail-changed',
self.__update_avail)
self.__update_avail() self.__update_avail()
self.set_tooltip_text(self.__option.get_help()) self.set_tooltip_text(self.__option.get_help())
@ -553,6 +567,7 @@ class GuiEnumeratedListOption(Gtk.Box):
# can add functionality # can add functionality
def value_changed(self): def value_changed(self):
""" Allow overriding so that another class can add functionality """
pass pass
def __update_options(self): def __update_options(self):
@ -648,9 +663,11 @@ class GuiPersonOption(Gtk.Box):
self.__update_person(person) self.__update_person(person)
self.valuekey = self.__option.connect('value-changed', self.__value_changed) self.valuekey = self.__option.connect('value-changed',
self.__value_changed)
self.conkey = self.__option.connect('avail-changed', self.__update_avail) self.conkey = self.__option.connect('avail-changed',
self.__update_avail)
self.__update_avail() self.__update_avail()
pevt.set_tooltip_text(self.__option.get_help()) pevt.set_tooltip_text(self.__option.get_help())
@ -756,9 +773,11 @@ class GuiFamilyOption(Gtk.Box):
self.__initialize_family(override) self.__initialize_family(override)
self.valuekey = self.__option.connect('value-changed', self.__value_changed) self.valuekey = self.__option.connect('value-changed',
self.__value_changed)
self.conkey = self.__option.connect('avail-changed', self.__update_avail) self.conkey = self.__option.connect('avail-changed',
self.__update_avail)
self.__update_avail() self.__update_avail()
pevt.set_tooltip_text(self.__option.get_help()) pevt.set_tooltip_text(self.__option.get_help())
@ -871,7 +890,8 @@ class GuiFamilyOption(Gtk.Box):
else: else:
mother_name = _("unknown mother") mother_name = _("unknown mother")
name = _("%(father_name)s and %(mother_name)s (%(family_id)s)") % { name = _(
"%(father_name)s and %(mother_name)s (%(family_id)s)") % {
'father_name': father_name, 'father_name': father_name,
'mother_name': mother_name, 'mother_name': mother_name,
'family_id': family_id} 'family_id': family_id}
@ -948,7 +968,8 @@ class GuiNoteOption(Gtk.Box):
note = self.__db.get_note_from_gramps_id(nid) note = self.__db.get_note_from_gramps_id(nid)
self.__update_note(note) self.__update_note(note)
self.valuekey = self.__option.connect('value-changed', self.__value_changed) self.valuekey = self.__option.connect('value-changed',
self.__value_changed)
self.__option.connect('avail-changed', self.__update_avail) self.__option.connect('avail-changed', self.__update_avail)
self.__update_avail() self.__update_avail()
@ -1052,7 +1073,8 @@ class GuiMediaOption(Gtk.Box):
media = self.__db.get_media_from_gramps_id(mid) media = self.__db.get_media_from_gramps_id(mid)
self.__update_media(media) self.__update_media(media)
self.valuekey = self.__option.connect('value-changed', self.__value_changed) self.valuekey = self.__option.connect('value-changed',
self.__value_changed)
self.__option.connect('avail-changed', self.__update_avail) self.__option.connect('avail-changed', self.__update_avail)
self.__update_avail() self.__update_avail()
@ -1172,7 +1194,8 @@ class GuiPersonListOption(Gtk.Box):
self.__vbbox.set_layout(Gtk.ButtonBoxStyle.SPREAD) self.__vbbox.set_layout(Gtk.ButtonBoxStyle.SPREAD)
self.pack_end(self.__vbbox, False, False, 0) self.pack_end(self.__vbbox, False, False, 0)
self.valuekey = self.__option.connect('value-changed', self.__value_changed) self.valuekey = self.__option.connect('value-changed',
self.__value_changed)
self.__tree_view.set_tooltip_text(self.__option.get_help()) self.__tree_view.set_tooltip_text(self.__option.get_help())
@ -1183,12 +1206,12 @@ class GuiPersonListOption(Gtk.Box):
# people we already have must be excluded # people we already have must be excluded
# so we don't list them multiple times # so we don't list them multiple times
skip_list = set() skip_list = set()
i = self.__model.get_iter_first() iii = self.__model.get_iter_first()
while (i): while iii:
gid = self.__model.get_value(i, 1) # get the GID stored in column #1 gid = self.__model.get_value(iii, 1) # get the GID stored in col. #1
person = self.__db.get_person_from_gramps_id(gid) person = self.__db.get_person_from_gramps_id(gid)
skip_list.add(person.get_handle()) skip_list.add(person.get_handle())
i = self.__model.iter_next(i) iii = self.__model.iter_next(iii)
select_class = SelectorFactory('Person') select_class = SelectorFactory('Person')
sel = select_class(self.__dbstate, self.__uistate, sel = select_class(self.__dbstate, self.__uistate,
@ -1214,8 +1237,7 @@ class GuiPersonListOption(Gtk.Box):
spouse_handle = family.get_father_handle() spouse_handle = family.get_father_handle()
if spouse_handle and (spouse_handle not in skip_list): if spouse_handle and (spouse_handle not in skip_list):
spouse = self.__db.get_person_from_handle( spouse = self.__db.get_person_from_handle(spouse_handle)
spouse_handle)
spouse_name = _nd.display(spouse) spouse_name = _nd.display(spouse)
text = _('Also include %s?') % spouse_name text = _('Also include %s?') % spouse_name
@ -1235,9 +1257,9 @@ class GuiPersonListOption(Gtk.Box):
Handle the delete person button. Handle the delete person button.
""" """
(path, column) = self.__tree_view.get_cursor() (path, column) = self.__tree_view.get_cursor()
if (path): if path:
i = self.__model.get_iter(path) iii = self.__model.get_iter(path)
self.__model.remove(i) self.__model.remove(iii)
self.__update_value() self.__update_value()
def __update_value(self): def __update_value(self):
@ -1245,11 +1267,11 @@ class GuiPersonListOption(Gtk.Box):
Parse the object and return. Parse the object and return.
""" """
gidlist = '' gidlist = ''
i = self.__model.get_iter_first() iii = self.__model.get_iter_first()
while (i): while iii:
gid = self.__model.get_value(i, 1) gid = self.__model.get_value(iii, 1)
gidlist = gidlist + gid + ' ' gidlist = gidlist + gid + ' '
i = self.__model.iter_next(i) iii = self.__model.iter_next(iii)
# Supress signals so that the set_value() handler # Supress signals so that the set_value() handler
# (__value_changed()) doesn't get called # (__value_changed()) doesn't get called
@ -1350,7 +1372,8 @@ class GuiPlaceListOption(Gtk.Box):
self.__vbbox.set_layout(Gtk.ButtonBoxStyle.SPREAD) self.__vbbox.set_layout(Gtk.ButtonBoxStyle.SPREAD)
self.pack_end(self.__vbbox, False, False, 0) self.pack_end(self.__vbbox, False, False, 0)
self.valuekey = self.__option.connect('value-changed', self.__value_changed) self.valuekey = self.__option.connect('value-changed',
self.__value_changed)
self.__tree_view.set_tooltip_text(self.__option.get_help()) self.__tree_view.set_tooltip_text(self.__option.get_help())
@ -1361,12 +1384,12 @@ class GuiPlaceListOption(Gtk.Box):
# places we already have must be excluded # places we already have must be excluded
# so we don't list them multiple times # so we don't list them multiple times
skip_list = set() skip_list = set()
i = self.__model.get_iter_first() iii = self.__model.get_iter_first()
while (i): while iii:
gid = self.__model.get_value(i, 1) # get the GID stored in column #1 gid = self.__model.get_value(iii, 1) # get the GID stored in col. #1
place = self.__db.get_place_from_gramps_id(gid) place = self.__db.get_place_from_gramps_id(gid)
skip_list.add(place.get_handle()) skip_list.add(place.get_handle())
i = self.__model.iter_next(i) iii = self.__model.iter_next(iii)
select_class = SelectorFactory('Place') select_class = SelectorFactory('Place')
sel = select_class(self.__dbstate, self.__uistate, sel = select_class(self.__dbstate, self.__uistate,
@ -1383,9 +1406,9 @@ class GuiPlaceListOption(Gtk.Box):
Handle the delete place button. Handle the delete place button.
""" """
(path, column) = self.__tree_view.get_cursor() (path, column) = self.__tree_view.get_cursor()
if (path): if path:
i = self.__model.get_iter(path) iii = self.__model.get_iter(path)
self.__model.remove(i) self.__model.remove(iii)
self.__update_value() self.__update_value()
def __update_value(self): def __update_value(self):
@ -1393,11 +1416,11 @@ class GuiPlaceListOption(Gtk.Box):
Parse the object and return. Parse the object and return.
""" """
gidlist = '' gidlist = ''
i = self.__model.get_iter_first() iii = self.__model.get_iter_first()
while (i): while iii:
gid = self.__model.get_value(i, 1) gid = self.__model.get_value(iii, 1)
gidlist = gidlist + gid + ' ' gidlist = gidlist + gid + ' '
i = self.__model.iter_next(i) iii = self.__model.iter_next(iii)
self.__option.set_value(gidlist) self.__option.set_value(gidlist)
def __value_changed(self): def __value_changed(self):
@ -1495,7 +1518,8 @@ class GuiSurnameColorOption(Gtk.Box):
self.__value_changed() self.__value_changed()
self.valuekey = self.__option.connect('value-changed', self.__value_changed) self.valuekey = self.__option.connect('value-changed',
self.__value_changed)
self.__tree_view.set_tooltip_text(self.__option.get_help()) self.__tree_view.set_tooltip_text(self.__option.get_help())
@ -1504,11 +1528,11 @@ class GuiSurnameColorOption(Gtk.Box):
Handle the add surname button. Handle the add surname button.
""" """
skip_list = set() skip_list = set()
i = self.__model.get_iter_first() iii = self.__model.get_iter_first()
while (i): while iii:
surname = self.__model.get_value(i, 0) surname = self.__model.get_value(iii, 0)
skip_list.add(surname.encode('iso-8859-1', 'xmlcharrefreplace')) skip_list.add(surname.encode('iso-8859-1', 'xmlcharrefreplace'))
i = self.__model.iter_next(i) iii = self.__model.iter_next(iii)
ln_dialog = LastNameDialog(self.__db, self.__uistate, ln_dialog = LastNameDialog(self.__db, self.__uistate,
self.__track, self.__surnames, skip_list) self.__track, self.__surnames, skip_list)
@ -1522,9 +1546,9 @@ class GuiSurnameColorOption(Gtk.Box):
Handle the delete surname button. Handle the delete surname button.
""" """
(path, column) = self.__tree_view.get_cursor() (path, column) = self.__tree_view.get_cursor()
if (path): if path:
i = self.__model.get_iter(path) iii = self.__model.get_iter(path)
self.__model.remove(i) self.__model.remove(iii)
self.__update_value() self.__update_value()
def __row_clicked(self, treeview, path, column): def __row_clicked(self, treeview, path, column):
@ -1532,10 +1556,10 @@ class GuiSurnameColorOption(Gtk.Box):
Handle the case of a row being clicked on. Handle the case of a row being clicked on.
""" """
# get the surname and colour value for this family # get the surname and colour value for this family
i = self.__model.get_iter(path) iii = self.__model.get_iter(path)
surname = self.__model.get_value(i, 0) surname = self.__model.get_value(iii, 0)
rgba = Gdk.RGBA() rgba = Gdk.RGBA()
rgba.parse(self.__model.get_value(i, 1)) rgba.parse(self.__model.get_value(iii, 1))
title = _('Select color for %s') % surname title = _('Select color for %s') % surname
colour_dialog = Gtk.ColorChooserDialog(title) colour_dialog = Gtk.ColorChooserDialog(title)
@ -1547,7 +1571,7 @@ class GuiSurnameColorOption(Gtk.Box):
colour_name = '#%02x%02x%02x' % (int(rgba.red * 255), colour_name = '#%02x%02x%02x' % (int(rgba.red * 255),
int(rgba.green * 255), int(rgba.green * 255),
int(rgba.blue * 255)) int(rgba.blue * 255))
self.__model.set_value(i, 1, colour_name) self.__model.set_value(iii, 1, colour_name)
colour_dialog.destroy() colour_dialog.destroy()
self.__update_value() self.__update_value()
@ -1557,13 +1581,13 @@ class GuiSurnameColorOption(Gtk.Box):
Parse the object and return. Parse the object and return.
""" """
surname_colours = '' surname_colours = ''
i = self.__model.get_iter_first() iii = self.__model.get_iter_first()
while (i): while iii:
surname = self.__model.get_value(i, 0) surname = self.__model.get_value(iii, 0)
#surname = surname.encode('iso-8859-1', 'xmlcharrefreplace') #surname = surname.encode('iso-8859-1', 'xmlcharrefreplace')
colour = self.__model.get_value(i, 1) colour = self.__model.get_value(iii, 1)
# Tried to use a dictionary, and tried to save it as a tuple, # Tried to use a dictionary, and tried to save it as a tuple,
# but coulnd't get this to work right -- this is lame, but now # but couldn't get this to work right -- this is lame, but now
# the surnames and colours are saved as a plain text string # the surnames and colours are saved as a plain text string
# #
# Hmmm...putting whitespace between the fields causes # Hmmm...putting whitespace between the fields causes
@ -1572,7 +1596,7 @@ class GuiSurnameColorOption(Gtk.Box):
# whitespace character which is unlikely to appear in # whitespace character which is unlikely to appear in
# a surname. (See bug report #2162.) # a surname. (See bug report #2162.)
surname_colours += surname + '\xb0' + colour + '\xb0' surname_colours += surname + '\xb0' + colour + '\xb0'
i = self.__model.iter_next(i) iii = self.__model.iter_next(iii)
self.__option.set_value(surname_colours) self.__option.set_value(surname_colours)
def __value_changed(self): def __value_changed(self):
@ -1610,7 +1634,7 @@ class GuiSurnameColorOption(Gtk.Box):
# support both the new and old format -- look for the \xb0 # support both the new and old format -- look for the \xb0
# delimiter, and if it isn't there, assume this is the old- # delimiter, and if it isn't there, assume this is the old-
# style space-delimited format. (Bug #2162.) # style space-delimited format. (Bug #2162.)
if (value.find('\xb0') >= 0): if value.find('\xb0') >= 0:
tmp = value.split('\xb0') tmp = value.split('\xb0')
else: else:
tmp = value.split(' ') tmp = value.split(' ')
@ -1662,10 +1686,13 @@ class GuiDestinationOption(Gtk.Box):
# a specific signal, we need to temporarily block the signal # a specific signal, we need to temporarily block the signal
# that would call the other signal handler. # that would call the other signal handler.
self.changekey = self.__entry.connect('changed', self.__text_changed) self.changekey = self.__entry.connect('changed', self.__text_changed)
self.valuekey = self.__option.connect('value-changed', self.__value_changed) self.valuekey = self.__option.connect('value-changed',
self.__value_changed)
self.conkey1 = self.__option.connect('options-changed', self.__option_changed) self.conkey1 = self.__option.connect('options-changed',
self.conkey2 = self.__option.connect('avail-changed', self.__update_avail) self.__option_changed)
self.conkey2 = self.__option.connect('avail-changed',
self.__update_avail)
self.__update_avail() self.__update_avail()
self.set_tooltip_text(self.__option.get_help()) self.set_tooltip_text(self.__option.get_help())
@ -1814,11 +1841,11 @@ class GuiBooleanListOption(Gtk.Box):
default = option.get_value().split(',') default = option.get_value().split(',')
if len(default) < 15: if len(default) < 15:
COLUMNS = 2 # number of checkbox columns columns = 2 # number of checkbox columns
else: else:
COLUMNS = 3 columns = 3
column = [] column = []
for i in range(COLUMNS): for dummy in range(columns):
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.pack_start(vbox, True, True, 0) self.pack_start(vbox, True, True, 0)
column.append(vbox) column.append(vbox)
@ -1840,12 +1867,13 @@ class GuiBooleanListOption(Gtk.Box):
button.show() button.show()
counter += 1 counter += 1
this_column_counter += 1 this_column_counter += 1
this_column_gets = (len(default)+(COLUMNS-(ncolumn+1))) // COLUMNS this_column_gets = (len(default)+(columns-(ncolumn+1))) // columns
if this_column_counter + 1 > this_column_gets: if this_column_counter + 1 > this_column_gets:
ncolumn += 1 ncolumn += 1
this_column_counter = 0 this_column_counter = 0
self.valuekey = self.__option.connect('value-changed', self.__value_changed) self.valuekey = self.__option.connect('value-changed',
self.__value_changed)
self.__option.connect('avail-changed', self.__update_avail) self.__option.connect('avail-changed', self.__update_avail)
self.__update_avail() self.__update_avail()
@ -1965,11 +1993,11 @@ def add_gui_options(dialog):
""" """
if not hasattr(dialog.options, "menu"): if not hasattr(dialog.options, "menu"):
return return
menu = dialog.options.menu o_menu = dialog.options.menu
options_dict = dialog.options.options_dict options_dict = dialog.options.options_dict
for category in menu.get_categories(): for category in o_menu.get_categories():
for name in menu.get_option_names(category): for name in o_menu.get_option_names(category):
option = menu.get_option(category, name) option = o_menu.get_option(category, name)
# override option default with xml-saved value: # override option default with xml-saved value:
if name in options_dict: if name in options_dict: