[PATCH] Make a couple UI modifications to the resize slider.
by Chris Lumens
(1) Add tick marks at the end and at every 20%.
(2) Move the current value to the top.
(3) Add an adjustment to make keyboard navigation possible.
(4) Completely hide the slider when the shrink button has not been clicked.
---
pyanaconda/ui/gui/spokes/lib/resize.glade | 7 +++++-
pyanaconda/ui/gui/spokes/lib/resize.py | 40 ++++++++++++++++++++++++-------
2 files changed, 37 insertions(+), 10 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.glade b/pyanaconda/ui/gui/spokes/lib/resize.glade
index 0c1ce28..ff8943d 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.glade
+++ b/pyanaconda/ui/gui/spokes/lib/resize.glade
@@ -23,6 +23,11 @@
<column type="gchararray"/>
</columns>
</object>
+ <object class="GtkAdjustment" id="resizeAdjustment">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
<object class="GtkDialog" id="resizeDialog">
<property name="height_request">550</property>
<property name="can_focus">False</property>
@@ -260,9 +265,9 @@
<property name="can_focus">True</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
+ <property name="adjustment">resizeAdjustment</property>
<property name="round_digits">1</property>
<property name="digits">0</property>
- <property name="value_pos">bottom</property>
<signal name="format-value" handler="resize_slider_format" swapped="no"/>
<signal name="value-changed" handler="on_resize_value_changed" swapped="no"/>
</object>
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.py b/pyanaconda/ui/gui/spokes/lib/resize.py
index 7a88d86..eaa7bca 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.py
+++ b/pyanaconda/ui/gui/spokes/lib/resize.py
@@ -50,7 +50,7 @@ SHRINK = N_("Shrink")
DELETE = N_("Delete")
class ResizeDialog(GUIObject):
- builderObjects = ["actionStore", "diskStore", "resizeDialog"]
+ builderObjects = ["actionStore", "diskStore", "resizeDialog", "resizeAdjustment"]
mainWidgetName = "resizeDialog"
uiFile = "spokes/lib/resize.glade"
@@ -213,6 +213,33 @@ class ResizeDialog(GUIObject):
text = _("Total selected space to reclaim: <b>%s</b>") % size_str(selectedReclaimable)
self._selected_label.set_markup(text)
+ def _setup_slider(self, device, value):
+ # Set up the slider for this device, pulling out any previously
+ # given shrink value as the default. Even if the device is not
+ # resizeable, we want to set up the right numbers here so it doesn't
+ # look weird.
+ self._resizeSlider.set_range(device.minSize, device.size)
+ self._resizeSlider.set_value(value)
+
+ # The slider needs to be keyboard-accessible. We'll make small movements change in
+ # 1% increments, and large movements in 5% increments.
+ distance = device.size - device.minSize
+ onePercent = distance*0.01
+ fivePercent = distance*0.05
+ twentyPercent = distance*0.2
+
+ adjustment = self.builder.get_object("resizeAdjustment")
+ adjustment.configure(value, device.minSize, device.size, onePercent, fivePercent, 0)
+
+ # And then the slider needs a couple tick marks for easier navigation.
+ self._resizeSlider.clear_marks()
+ for i in range(1, 5):
+ self._resizeSlider.add_mark(device.minSize + i*twentyPercent, Gtk.PositionType.BOTTOM, None)
+
+ # Finally, add tick marks for the ends.
+ self._resizeSlider.add_mark(device.minSize, Gtk.PositionType.BOTTOM, size_str(device.minSize))
+ self._resizeSlider.add_mark(device.size, Gtk.PositionType.BOTTOM, size_str(device.size))
+
def _update_action_buttons(self, row):
device = self.storage.devicetree.getDeviceByID(row[DEVICE_ID_COL])
@@ -221,7 +248,7 @@ class ResizeDialog(GUIObject):
self._preserveButton.set_sensitive(row[EDITABLE_COL])
self._shrinkButton.set_sensitive(row[EDITABLE_COL] and not device.isDisk)
self._deleteButton.set_sensitive(row[EDITABLE_COL])
- self._resizeSlider.set_sensitive(False)
+ self._resizeSlider.set_visible(False)
if not row[EDITABLE_COL]:
return
@@ -230,12 +257,7 @@ class ResizeDialog(GUIObject):
# button insensitive.
self._shrinkButton.set_sensitive(device.resizable)
- # Set up the slider for this device, pulling out any previously
- # given shrink value as the default. Even if the device is not
- # resizeable, we want to set up the right numbers here so it doesn't
- # look weird.
- self._resizeSlider.set_range(device.minSize, device.size)
- self._resizeSlider.set_value(row[RESIZE_TARGET_COL])
+ self._setup_slider(device, row[RESIZE_TARGET_COL])
# Then, disable the button for whatever action is currently selected.
# It doesn't make a lot of sense to allow clicking that.
@@ -243,7 +265,7 @@ class ResizeDialog(GUIObject):
self._preserveButton.set_sensitive(False)
elif row[ACTION_COL] == _(SHRINK):
self._shrinkButton.set_sensitive(False)
- self._resizeSlider.set_sensitive(True)
+ self._resizeSlider.set_visible(True)
elif row[ACTION_COL] == _(DELETE):
self._deleteButton.set_sensitive(False)
--
1.8.1.2
11 years, 1 month
[PATCH] Allow clicking on environment and addon text to toggle them (#928010).
by Chris Lumens
---
pyanaconda/ui/gui/spokes/software.glade | 8 ++++++--
pyanaconda/ui/gui/spokes/software.py | 17 +++++++++++++++++
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/software.glade b/pyanaconda/ui/gui/spokes/software.glade
index 0dbee9d..bda4f9e 100644
--- a/pyanaconda/ui/gui/spokes/software.glade
+++ b/pyanaconda/ui/gui/spokes/software.glade
@@ -137,7 +137,9 @@
<property name="headers_clickable">False</property>
<property name="search_column">0</property>
<child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection2"/>
+ <object class="GtkTreeSelection" id="addonSelector">
+ <signal name="changed" handler="on_addon_selection_changed" swapped="no"/>
+ </object>
</child>
<child>
<object class="GtkTreeViewColumn" id="addonSelectedCol">
@@ -201,7 +203,9 @@
<property name="headers_clickable">False</property>
<property name="search_column">0</property>
<child internal-child="selection">
- <object class="GtkTreeSelection" id="environmentSelector"/>
+ <object class="GtkTreeSelection" id="environmentSelector">
+ <signal name="changed" handler="on_environment_selection_changed" swapped="no"/>
+ </object>
</child>
<child>
<object class="GtkTreeViewColumn" id="environmentSelectedCol">
diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index 55af428..4d95ba1 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -316,6 +316,15 @@ class SoftwareSelectionSpoke(NormalSpoke):
self.environment = self._environmentStore[path][2]
self.refreshAddons()
+ def on_environment_selection_changed(self, selection):
+ (model, itr) = selection.get_selected()
+ if not itr:
+ return
+
+ # Only do something if the row's not previously been selected.
+ if not model[itr][0]:
+ self.on_environment_toggled(None, model.get_path(itr))
+
def on_addon_toggled(self, renderer, path):
selected = not self._addonStore[path][0]
group = self._addonStore[path][2]
@@ -330,6 +339,14 @@ class SoftwareSelectionSpoke(NormalSpoke):
elif not selected and group in self.selectedGroups:
self.selectedGroups.remove(group)
+ def on_addon_selection_changed(self, selection):
+ (model, itr) = selection.get_selected()
+ if not itr:
+ return
+
+ # Always do something here, since addons can be toggled.
+ self.on_addon_toggled(None, model.get_path(itr))
+
def on_custom_clicked(self, button):
with enlightbox(self.window, self._addRepoDialog.window):
response = self._addRepoDialog.run()
--
1.8.1.2
11 years, 1 month
[PATCH] Make several changes to how addons are displayed (#873498).
by Chris Lumens
(1) Change the labels at the top of the software spoke so it looks like the
thing on the left side and the thing on the right side are related.
(2) Show environment-specific addons at the top of the list, followed by
generic ones. Each set of addons is sorted alphabetically.
(3) Display a thin separator after the environment-specific addons.
---
pyanaconda/ui/gui/spokes/software.glade | 6 ++++--
pyanaconda/ui/gui/spokes/software.py | 36 +++++++++++++++++++++++++++++----
2 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/software.glade b/pyanaconda/ui/gui/spokes/software.glade
index 0b4ca77..8dac27c 100644
--- a/pyanaconda/ui/gui/spokes/software.glade
+++ b/pyanaconda/ui/gui/spokes/software.glade
@@ -10,6 +10,8 @@
<column type="gchararray"/>
<!-- column-name addonName -->
<column type="gchararray"/>
+ <!-- column-name addonSeparator -->
+ <column type="gboolean"/>
</columns>
</object>
<object class="GtkListStore" id="environmentStore">
@@ -84,7 +86,7 @@
<property name="margin_bottom">6</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Choose your environment</property>
+ <property name="label" translatable="yes">Base Environment</property>
<attributes>
<attribute name="font-desc" value="Cantarell 12"/>
<attribute name="weight" value="normal"/>
@@ -104,7 +106,7 @@
<property name="margin_bottom">6</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Choose your add-ons</property>
+ <property name="label" translatable="yes">Add-Ons for Selected Environment</property>
<attributes>
<attribute name="font-desc" value="Cantarell 12"/>
<attribute name="weight" value="normal"/>
diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index 0f81fe8..a628b76 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -64,6 +64,9 @@ class SoftwareSelectionSpoke(NormalSpoke):
self._origAddons = []
self._origEnvironment = None
+ # We need to tell the addon view whether something is a separator or not.
+ self.builder.get_object("addonView").set_row_separator_func(self._addon_row_is_separator, None)
+
def _apply(self):
row = self._get_selected_environment()
if not row:
@@ -258,18 +261,43 @@ class SoftwareSelectionSpoke(NormalSpoke):
self.refreshAddons()
+ def _addon_row_is_separator(self, model, itr, *args):
+ # The last column of the model tells us if this row is a separator or not.
+ return model[itr][3]
+
+ def _addAddon(self, grp):
+ (name, desc) = self.payload.groupDescription(grp)
+ selected = grp in self.selectedGroups
+
+ self._addonStore.append([selected, "<b>%s</b>\n%s" % (name, desc), grp, False])
+
def refreshAddons(self):
from gi.repository import Gtk
self._addonStore = self.builder.get_object("addonStore")
self._addonStore.clear()
if self.environment:
+ # First, we make up two lists: One of addons specific to this environment,
+ # and one of all the others. The environment-specific ones will be displayed
+ # first and then a separator, and then the generic ones. This is to make it
+ # a little more obvious that the thing on the left side of the screen and the
+ # thing on the right side of the screen are related.
+ specific = []
+ generic = []
+
for grp in self.payload.groups:
- if self.payload.environmentHasOption(self.environment, grp) or (self.payload._isGroupVisible(grp) and self.payload._groupHasInstallableMembers(grp)):
- (name, desc) = self.payload.groupDescription(grp)
- selected = grp in self.selectedGroups
+ if self.payload.environmentHasOption(self.environment, grp):
+ specific.append(grp)
+ elif self.payload._isGroupVisible(grp) and self.payload._groupHasInstallableMembers(grp):
+ generic.append(grp)
+
+ for grp in specific:
+ self._addAddon(grp)
+
+ self._addonStore.append([False, "", "", True])
- self._addonStore.append([selected, "<b>%s</b>\n%s" % (name, desc), grp])
+ for grp in generic:
+ self._addAddon(grp)
self._selectFlag = True
--
1.8.1.2
11 years, 1 month
[PATCH 2/3] Hook the Geolocation module to Anaconda
by Martin Kolman
First, the module is initilized and asynchronous location info
refresh is started. Then once the welcome spoke is initialized,
it asks the geolocation module for the territory code.
If the code is unknown (either due to the lookup not returning
any result or still being in progress), default language value is used.
Also, if geolocation returns more than one language, default
langugae is used. This is because some countries, such as Switzerland,
have more than one locale and there is no clear priority which one to
use.
There is a boot option called "geoloc", that can be
used to configure the geolocation module.
It currently supports these values:
not set - use geolocation with default provider
"0" - don't use geolocation
"provider_mirror_manager" - use the Fedora MirrorManager as the
geolocation provider (default)
"provider_hostip" - use Hostip.info as geolocation provider
The "provider_*" strings are defined by the "GEOLOC_PROVIDER_*"
constants in the constants module.
Signed-off-by: Martin Kolman <mkolman(a)gmail.com>
---
anaconda | 30 +++++++++++++++++++++++
pyanaconda/ui/gui/spokes/welcome.py | 47 +++++++++++++++++++++++++++++--------
2 files changed, 67 insertions(+), 10 deletions(-)
diff --git a/anaconda b/anaconda
index 57065f9..fb9380a 100755
--- a/anaconda
+++ b/anaconda
@@ -274,6 +274,9 @@ def parseOptions(argv=None, cmdline=None):
op.add_option("--noiscsi", dest="iscsi", action="store_false", default=False)
op.add_option("--iscsi", action="store_true")
+ # Geolocation
+ op.add_option("--geoloc")
+
# Miscellaneous
op.add_option("--module", action="append", default=[])
op.add_option("--nomount", dest="rescue_nomount", action="store_true", default=False)
@@ -673,6 +676,7 @@ if __name__ == "__main__":
from pyanaconda import constants
from pyanaconda import addons
+ from pyanaconda import geoloc
# do this early so we can set flags before initializing logging
from pyanaconda.flags import flags, can_touch_runtime_system
@@ -1032,6 +1036,32 @@ if __name__ == "__main__":
atexit.register(exitHandler, ksdata.reboot, anaconda.storage)
+ # check if geolocation should be enabled for this type of installation
+ use_geolocation = True
+ if flags.imageInstall or flags.dirInstall:
+ use_geolocation = False
+ # and also check if it was not disabled by boot option
+ else:
+ # flags.cmdline.getbool is used as it handles values such as
+ # 0, no, off and also nogeoloc as False
+ # and other values or geoloc not being present as True
+ use_geolocation = flags.cmdline.getbool('geoloc', True)
+
+
+ if use_geolocation:
+ provider_id = constants.GEOLOC_DEFAULT_PROVIDER
+ # check if a provider was specified by an option
+ if opts.geoloc is not None:
+ parsed_id = geoloc.get_provider_id_from_option(opts.geoloc)
+ if parsed_id is None:
+ log.error('geoloc: wrong provider id specified: %s' %
+ opts.geoloc)
+ else:
+ provider_id = parsed_id
+ # instantiate the geolocation module and start location data refresh
+ geoloc.init_geolocation(provider_id=provider_id)
+ geoloc.refresh()
+
# setup ntp servers and start NTP daemon if not requested otherwise
if can_touch_runtime_system("start chronyd"):
if anaconda.ksdata.timezone.ntpservers:
diff --git a/pyanaconda/ui/gui/spokes/welcome.py b/pyanaconda/ui/gui/spokes/welcome.py
index 402ff05..f981464 100644
--- a/pyanaconda/ui/gui/spokes/welcome.py
+++ b/pyanaconda/ui/gui/spokes/welcome.py
@@ -38,6 +38,10 @@ from pyanaconda.product import distributionText, isFinal, productName, productVe
from pyanaconda import keyboard
from pyanaconda import timezone
from pyanaconda import flags
+from pyanaconda import geoloc
+
+import logging
+log = logging.getLogger("anaconda")
__all__ = ["WelcomeLanguageSpoke", "LanguageSpoke"]
@@ -66,11 +70,18 @@ class LanguageMixIn(object):
if flags.flags.automatedInstall:
return
- #TODO: better use GeoIP data once it is available
- if self.language.territory and not self.data.timezone.timezone:
+ lang_timezone = None
+ # check the geolocation data for territory code
+ geoloc_territory = geoloc.get_territory_code()
+ if geoloc_territory:
+ lang_timezone = timezone.get_preferred_timezone(geoloc_territory)
+ # if no data is provided by Geolocation,
+ # try to get timezone from the current language
+ elif self.language.territory and not self.data.timezone.timezone:
lang_timezone = timezone.get_preferred_timezone(self.language.territory)
- if lang_timezone:
- self.data.timezone.timezone = lang_timezone
+
+ if lang_timezone:
+ self.data.timezone.timezone = lang_timezone
lang_country = self.language.preferred_locale.territory
self._set_keyboard_defaults(store[itr][1], lang_country)
@@ -137,12 +148,22 @@ class LanguageMixIn(object):
self._selection = self.builder.get_object(self._selectionName)
self._view = self.builder.get_object(self._viewName)
- # TODO We can use the territory from geoip here
+ # We can use the territory from geolocation here
# to preselect the translation, when it's available.
- # Until then, use None.
- territory = None
+ territory = geoloc.get_territory_code()
self.language = Language(LOCALE_PREFERENCES, territory=territory)
-
+ # check if there is one and only one locale for the territory
+ if len(self.language.preferred_locales) != 1:
+ log.info("Didn't get a single locale from Geolocation,"
+ " falling back to default locale.")
+ self.language = Language(LOCALE_PREFERENCES, territory=None)
+ # Explanation:
+ # Some territories have multiple locales,
+ # for example, the Switzerland has:
+ # de_CH, it_CH and fr_CH
+ # As there is no clear order of preference for them,
+ # it is safer to just fall back to the default locale.
+
# fill the list with available translations
for _code, trans in sorted(self.language.translations.items()):
self._addLanguage(store, trans.display_name,
@@ -151,8 +172,14 @@ class LanguageMixIn(object):
# select the preferred translation if there wasn't any
(store, itr) = self._selection.get_selected()
if not itr:
- lang = self.data.lang.lang or \
- self.language.preferred_translation.short_name
+ # check if a language was set by kickstart
+ # NOTE: seen means the language was "seen" in
+ # kickstart or boot option, so it overrides
+ # the language detected by geolocation
+ if self.data.lang.lang and self.data.lang.seen:
+ lang = self.data.lang.lang
+ else:
+ lang = self.language.preferred_translation.short_name
self._selectLanguage(store, lang)
self._languageStoreFilter.set_visible_func(self._matchesEntry, None)
--
1.8.1.4
11 years, 1 month
[PATCH 2/3] Hook the Geolocation module to Anaconda
by Martin Kolman
First, the module is initilized and asynchronous location info
refresh is started. Then once the welcome spoke is initialized,
it asks the geolocation module for the territory code.
If the code is unknown (either due to the lookup not returning
any result or still being in progress), default language value is used.
Also, if geolocation returns more than one language, default
langugae is used. This is because some countries, such as Switzerland,
have more than one locale and there is no clear priority which one to
use.
There is a boot option called "geoloc", that can be
used to configure the geolocation module.
It currently supports these values:
not set - use geolocation with default provider
"0" - don't use geolocation
"provider_mirror_manager" - use the Fedora MirrorManager as the
geolocation provider (default)
"provider_hostip" - use Hostip.info as geolocation provider
The "provider_*" strings are defined by the "GEOLOC_PROVIDER_*"
constants in the constants module.
Signed-off-by: Martin Kolman <mkolman(a)gmail.com>
---
anaconda | 30 +++++++++++++++++++++++
pyanaconda/ui/gui/spokes/welcome.py | 47 +++++++++++++++++++++++++++++--------
2 files changed, 67 insertions(+), 10 deletions(-)
diff --git a/anaconda b/anaconda
index 57065f9..fb9380a 100755
--- a/anaconda
+++ b/anaconda
@@ -274,6 +274,9 @@ def parseOptions(argv=None, cmdline=None):
op.add_option("--noiscsi", dest="iscsi", action="store_false", default=False)
op.add_option("--iscsi", action="store_true")
+ # Geolocation
+ op.add_option("--geoloc")
+
# Miscellaneous
op.add_option("--module", action="append", default=[])
op.add_option("--nomount", dest="rescue_nomount", action="store_true", default=False)
@@ -673,6 +676,7 @@ if __name__ == "__main__":
from pyanaconda import constants
from pyanaconda import addons
+ from pyanaconda import geoloc
# do this early so we can set flags before initializing logging
from pyanaconda.flags import flags, can_touch_runtime_system
@@ -1032,6 +1036,32 @@ if __name__ == "__main__":
atexit.register(exitHandler, ksdata.reboot, anaconda.storage)
+ # check if geolocation should be enabled for this type of installation
+ use_geolocation = True
+ if flags.imageInstall or flags.dirInstall:
+ use_geolocation = False
+ # and also check if it was not disabled by boot option
+ else:
+ # flags.cmdline.getbool is used as it handles values such as
+ # 0, no, off and also nogeoloc as False
+ # and other values or geoloc not being present as True
+ use_geolocation = flags.cmdline.getbool('geoloc', True)
+
+
+ if use_geolocation:
+ provider_id = constants.GEOLOC_DEFAULT_PROVIDER
+ # check if a provider was specified by an option
+ if opts.geoloc is not None:
+ parsed_id = geoloc.get_provider_id_from_option(opts.geoloc)
+ if parsed_id is None:
+ log.error('geoloc: wrong provider id specified: %s' %
+ opts.geoloc)
+ else:
+ provider_id = parsed_id
+ # instantiate the geolocation module and start location data refresh
+ geoloc.init_geolocation(provider_id=provider_id)
+ geoloc.refresh()
+
# setup ntp servers and start NTP daemon if not requested otherwise
if can_touch_runtime_system("start chronyd"):
if anaconda.ksdata.timezone.ntpservers:
diff --git a/pyanaconda/ui/gui/spokes/welcome.py b/pyanaconda/ui/gui/spokes/welcome.py
index 402ff05..f981464 100644
--- a/pyanaconda/ui/gui/spokes/welcome.py
+++ b/pyanaconda/ui/gui/spokes/welcome.py
@@ -38,6 +38,10 @@ from pyanaconda.product import distributionText, isFinal, productName, productVe
from pyanaconda import keyboard
from pyanaconda import timezone
from pyanaconda import flags
+from pyanaconda import geoloc
+
+import logging
+log = logging.getLogger("anaconda")
__all__ = ["WelcomeLanguageSpoke", "LanguageSpoke"]
@@ -66,11 +70,18 @@ class LanguageMixIn(object):
if flags.flags.automatedInstall:
return
- #TODO: better use GeoIP data once it is available
- if self.language.territory and not self.data.timezone.timezone:
+ lang_timezone = None
+ # check the geolocation data for territory code
+ geoloc_territory = geoloc.get_territory_code()
+ if geoloc_territory:
+ lang_timezone = timezone.get_preferred_timezone(geoloc_territory)
+ # if no data is provided by Geolocation,
+ # try to get timezone from the current language
+ elif self.language.territory and not self.data.timezone.timezone:
lang_timezone = timezone.get_preferred_timezone(self.language.territory)
- if lang_timezone:
- self.data.timezone.timezone = lang_timezone
+
+ if lang_timezone:
+ self.data.timezone.timezone = lang_timezone
lang_country = self.language.preferred_locale.territory
self._set_keyboard_defaults(store[itr][1], lang_country)
@@ -137,12 +148,22 @@ class LanguageMixIn(object):
self._selection = self.builder.get_object(self._selectionName)
self._view = self.builder.get_object(self._viewName)
- # TODO We can use the territory from geoip here
+ # We can use the territory from geolocation here
# to preselect the translation, when it's available.
- # Until then, use None.
- territory = None
+ territory = geoloc.get_territory_code()
self.language = Language(LOCALE_PREFERENCES, territory=territory)
-
+ # check if there is one and only one locale for the territory
+ if len(self.language.preferred_locales) != 1:
+ log.info("Didn't get a single locale from Geolocation,"
+ " falling back to default locale.")
+ self.language = Language(LOCALE_PREFERENCES, territory=None)
+ # Explanation:
+ # Some territories have multiple locales,
+ # for example, the Switzerland has:
+ # de_CH, it_CH and fr_CH
+ # As there is no clear order of preference for them,
+ # it is safer to just fall back to the default locale.
+
# fill the list with available translations
for _code, trans in sorted(self.language.translations.items()):
self._addLanguage(store, trans.display_name,
@@ -151,8 +172,14 @@ class LanguageMixIn(object):
# select the preferred translation if there wasn't any
(store, itr) = self._selection.get_selected()
if not itr:
- lang = self.data.lang.lang or \
- self.language.preferred_translation.short_name
+ # check if a language was set by kickstart
+ # NOTE: seen means the language was "seen" in
+ # kickstart or boot option, so it overrides
+ # the language detected by geolocation
+ if self.data.lang.lang and self.data.lang.seen:
+ lang = self.data.lang.lang
+ else:
+ lang = self.language.preferred_translation.short_name
self._selectLanguage(store, lang)
self._languageStoreFilter.set_visible_func(self._matchesEntry, None)
--
1.8.1.4
11 years, 1 month
[PATCH 0/3] Geolocation patches V2
by Martin Kolman
* the module now uses sphinx docstrings
* can be configured by the "geoloc" boot option:
not set - use geolocation with the default provider
"0" - don't use geolocation
"provider_mirror_manager" - use the Fedora MirrorManager
for geolocation (default)
"provider_hostip" - use Hostip.info
* exceptions were converted to logged warnings
* instead of setting the default language in the
welcome spoke, I've left the default setting in
kickstart.py and use the .seen flag to distinguish
between the default and a value set by the user
* won't run on image and directory installs
* log messages are no longer translated
* provider ids moved to constants
* fix for anaconda not setting the seen flag for
language set by boot option
* code cleanup
Martin Kolman (3):
Add geolocation module
Hook the Geolocation module to Anaconda
Set seen for lang from option & use constant for default
anaconda | 33 +-
pyanaconda/constants.py | 15 +
pyanaconda/geoloc.py | 779 ++++++++++++++++++++++++++++++++++++
pyanaconda/ui/gui/spokes/welcome.py | 47 ++-
4 files changed, 862 insertions(+), 12 deletions(-)
create mode 100644 pyanaconda/geoloc.py
--
1.8.1.4
11 years, 1 month
[PATCH] Fix scrolling problems on the environment side of software selection (#928008).
by Chris Lumens
This also appears to fix the magic disappearing scroll bar.
---
pyanaconda/ui/gui/spokes/software.glade | 79 ++++++++++++++-------------------
1 file changed, 34 insertions(+), 45 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/software.glade b/pyanaconda/ui/gui/spokes/software.glade
index 676c14d..0dbee9d 100644
--- a/pyanaconda/ui/gui/spokes/software.glade
+++ b/pyanaconda/ui/gui/spokes/software.glade
@@ -39,6 +39,7 @@
<property name="orientation">vertical</property>
<child internal-child="nav_box">
<object class="GtkEventBox" id="AnacondaSpokeWindow-nav_box1">
+ <property name="can_focus">False</property>
<child internal-child="nav_area">
<object class="GtkGrid" id="AnacondaSpokeWindow-nav_area1">
<property name="can_focus">False</property>
@@ -189,58 +190,48 @@
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkViewport" id="viewport2">
+ <object class="GtkTreeView" id="environmentView">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
+ <property name="border_width">12</property>
+ <property name="model">environmentStore</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ <property name="search_column">0</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="environmentSelector"/>
+ </child>
<child>
- <object class="GtkTreeView" id="environmentView">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="margin_top">6</property>
- <property name="margin_bottom">6</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="border_width">12</property>
- <property name="model">environmentStore</property>
- <property name="headers_visible">False</property>
- <property name="headers_clickable">False</property>
- <property name="search_column">0</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="environmentSelector"/>
- </child>
+ <object class="GtkTreeViewColumn" id="environmentSelectedCol">
+ <property name="title" translatable="yes">column</property>
<child>
- <object class="GtkTreeViewColumn" id="environmentSelectedCol">
- <property name="title" translatable="yes">column</property>
- <child>
- <object class="GtkCellRendererToggle" id="environmentSelectedRenderer">
- <property name="yalign">0</property>
- <property name="radio">True</property>
- <signal name="toggled" handler="on_environment_toggled" swapped="no"/>
- </object>
- <attributes>
- <attribute name="active">0</attribute>
- </attributes>
- </child>
+ <object class="GtkCellRendererToggle" id="environmentSelectedRenderer">
+ <property name="yalign">0</property>
+ <property name="radio">True</property>
+ <signal name="toggled" handler="on_environment_toggled" swapped="no"/>
</object>
+ <attributes>
+ <attribute name="active">0</attribute>
+ </attributes>
</child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="environmentDescCol">
+ <property name="title" translatable="yes">column</property>
+ <property name="expand">True</property>
<child>
- <object class="GtkTreeViewColumn" id="environmentDescCol">
- <property name="title" translatable="yes">column</property>
- <property name="expand">True</property>
- <child>
- <object class="GtkCellRendererText" id="environmentDescRenderer">
- <property name="width">250</property>
- <property name="yalign">0</property>
- <property name="wrap_mode">word-char</property>
- <property name="wrap_width">200</property>
- </object>
- <attributes>
- <attribute name="markup">1</attribute>
- </attributes>
- </child>
+ <object class="GtkCellRendererText" id="environmentDescRenderer">
+ <property name="width">250</property>
+ <property name="yalign">0</property>
+ <property name="wrap_mode">word-char</property>
+ <property name="wrap_width">200</property>
</object>
+ <attributes>
+ <attribute name="markup">1</attribute>
+ </attributes>
</child>
</object>
</child>
@@ -264,14 +255,12 @@
<child>
<object class="GtkButton" id="addAddonButton">
<property name="label" translatable="yes">_Add custom add-on...</property>
- <property name="use_action_appearance">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
<property name="halign">end</property>
<property name="valign">start</property>
<property name="margin_top">6</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_custom_clicked" swapped="no"/>
</object>
--
1.8.1.2
11 years, 1 month
[PATCH] Exclude a couple more password variables from dumps
by Brian C. Lane
From: "Brian C. Lane" <bcl(a)redhat.com>
---
pyanaconda/exception.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py
index a205365..1990e31 100644
--- a/pyanaconda/exception.py
+++ b/pyanaconda/exception.py
@@ -172,6 +172,10 @@ def initExceptionHandling(anaconda):
"_intf._currentAction._xklwrapper",
"_intf._currentAction.language.translations",
"_intf._currentAction.language.locales",
+ "_intf._currentAction._spokes[\"PasswordSpoke\"]._oldweak",
+ "_intf._currentAction._spokes[\"PasswordSpoke\"]._password",
+ "_intf._currentAction._spokes[\"UserSpoke\"]._password",
+ "_intf._currentAction._spokes[\"UserSpoke\"]._oldweak",
"_intf.storage.bootloader.password",
"_intf.storage.data",
"_intf.storage.encryptionPassphrase",
@@ -179,7 +183,7 @@ def initExceptionHandling(anaconda):
"_bootloader.password",
"payload._groups",
"payload._yum"],
- localSkipList=[ "passphrase", "password" ],
+ localSkipList=[ "passphrase", "password", "_oldweak", "_password" ],
fileList=fileList)
conf.register_callback("lsblk_output", lsblk_callback, attchmnt_only=True)
--
1.8.1.4
11 years, 1 month
[PATCH] remove no longer supported arm kernel variants add the new lpae one
by Dennis Gilmore
---
share/arm.tmpl | 6 +-----
share/runtime-install.tmpl | 2 +-
src/pylorax/treebuilder.py | 2 +-
3 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/share/arm.tmpl b/share/arm.tmpl
index 610d113..637e13f 100644
--- a/share/arm.tmpl
+++ b/share/arm.tmpl
@@ -9,11 +9,7 @@ LIVEDIR="LiveOS"
# different platforms use different kernel load addresses.
# include a 'baseline' kernel for no 'flavor'.
kernelAddress = { 'baseline' : '0x00008000',
- 'highbank' : '0x00008000',
- 'imx' : '0x90008000',
- 'kirkwood' : '0x00008000',
- 'mvebu' : '0x00008000',
- 'omap' : '0x80008000',
+ 'lpae' : '0x00008000',
'tegra' : '0x00008000',
}
diff --git a/share/runtime-install.tmpl b/share/runtime-install.tmpl
index e8ae7b7..c02159c 100644
--- a/share/runtime-install.tmpl
+++ b/share/runtime-install.tmpl
@@ -22,7 +22,7 @@ installpkg kernel
## arch-specific packages (bootloaders etc.)
%if basearch in ("arm", "armhfp"):
- installpkg kernel-highbank kernel-imx kernel-kirkwood kernel-mvebu kernel-omap kernel-tegra
+ installpkg kernel-lpae kernel-tegra
installpkg uboot-tools
%endif
%if basearch == "i386":
diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py
index 4275550..136aa20 100644
--- a/src/pylorax/treebuilder.py
+++ b/src/pylorax/treebuilder.py
@@ -264,7 +264,7 @@ class TreeBuilder(object):
def findkernels(root="/", kdir="boot"):
# To find possible flavors, awk '/BuildKernel/ { print $4 }' kernel.spec
- flavors = ('debug', 'PAE', 'PAEdebug', 'smp', 'xen', 'highbank', 'imx', 'kirkwood', 'mvebu', 'omap', 'tegra')
+ flavors = ('debug', 'PAE', 'PAEdebug', 'smp', 'xen', 'lpae', 'tegra')
kre = re.compile(r"vmlinuz-(?P<version>.+?\.(?P<arch>[a-z0-9_]+)"
r"(\.(?P<flavor>{0}))?)$".format("|".join(flavors)))
kernels = []
--
1.8.2
11 years, 1 month
[PATCH] Fix two more syntax errors in the custom spoke. (#952662)
by David Lehman
---
pyanaconda/ui/gui/spokes/custom.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 13a2353..26a4902 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -1211,13 +1211,14 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
# which case we're not going to schedule another reformat unless
# encryption got toggled
do_reformat = (reformat and (changed_encryption or
- fs_type_changed or
+ changed_fs_type or
device.format.exists))
if do_reformat:
self.clear_errors()
#
# ENCRYPTION
#
+ old_device = None
if changed_encryption:
if not encrypted:
log.info("removing encryption from %s" % device.name)
--
1.8.1.4
11 years, 1 month