The goal here is to not allow selecting the Closest mirror option on trees that
do not include a repo config file supporting it. This seems to be the easiest
way to do it, though I have not been able to test it thoroughly due to trees
being broken in other ways. It does not break the standard Fedora case, though.
Additionally, I've moved Closest mirror to the last option in the combo box so
it can be removed without having to move all the other options around.
---
pyanaconda/packaging/__init__.py | 7 +++++++
pyanaconda/packaging/yumpayload.py | 5 +++++
pyanaconda/ui/gui/spokes/source.glade | 2 +-
pyanaconda/ui/gui/spokes/source.py | 30 +++++++++++++++++++++---------
4 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index f095dea..fb72e82 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -146,6 +146,13 @@ class Payload(object):
""" The identifier of the current base repo. """
return None
+ @property
+ def mirrorEnabled(self):
+ """Is the closest/fastest mirror option enabled? This does not
make
+ sense for those payloads that do not support this concept.
+ """
+ return True
+
def getRepo(self, repo_id):
""" Return the package repo object. """
raise NotImplementedError()
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 3209fe4..2dd81e1 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -410,6 +410,11 @@ reposdir=%s
return base_repo_name
+ @property
+ def mirrorEnabled(self):
+ with _yum_lock:
+ return "fastestmirror" in self._yum.plugins.enabledPlugins
+
def getRepo(self, repo_id):
""" Return the yum repo object. """
with _yum_lock:
diff --git a/pyanaconda/ui/gui/spokes/source.glade
b/pyanaconda/ui/gui/spokes/source.glade
index 78ec539..2cc41f2 100644
--- a/pyanaconda/ui/gui/spokes/source.glade
+++ b/pyanaconda/ui/gui/spokes/source.glade
@@ -755,11 +755,11 @@
<property
name="can_focus">False</property>
<property name="active">0</property>
<items>
- <item translatable="yes">Closest
mirror</item>
<item
translatable="yes">http://</item>
<item
translatable="yes">https://</item>
<item
translatable="yes">ftp://</item>
<item translatable="yes">nfs</item>
+ <item translatable="yes">Closest
mirror</item>
</items>
<signal name="changed"
handler="on_protocol_changed" swapped="no"/>
</object>
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index accd19a..e9ecc7c 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -53,6 +53,13 @@ BASEREPO_SETUP_MESSAGE = N_("Setting up installation
source...")
METADATA_DOWNLOAD_MESSAGE = N_("Downloading package metadata...")
METADATA_ERROR_MESSAGE = N_("Error downloading package metadata...")
+# These need to be in the same order as the items in protocolComboBox in source.glade.
+PROTOCOL_HTTP = 0
+PROTOCOL_HTTPS = 1
+PROTOCOL_FTP = 2
+PROTOCOL_NFS = 3
+PROTOCOL_MIRROR = 4
+
# Repo Store Columns
REPO_ENABLED_COL = 0
REPO_NAME_COL = 1
@@ -554,6 +561,11 @@ class SourceSpoke(NormalSpoke):
added = False
+ # If there's no fallback mirror to use, we should just disable that option
+ # in the UI.
+ if not self.payload.mirrorEnabled:
+ self._protocolComboBox.remove(PROTOCOL_MIRROR)
+
# If we've previously set up to use a CD/DVD method, the media has
# already been mounted by payload.setup. We can't try to mount it
# again. So just use what we already know to create the selector.
@@ -621,7 +633,7 @@ class SourceSpoke(NormalSpoke):
# We default to the mirror list, and then if the method tells us
# something different later, we can change it.
- self._protocolComboBox.set_active(0)
+ self._protocolComboBox.set_active(PROTOCOL_MIRROR)
self._urlEntry.set_sensitive(False)
# Set up the default state of UI elements.
@@ -630,13 +642,13 @@ class SourceSpoke(NormalSpoke):
proto = self.data.method.url or self.data.method.mirrorlist
if proto.startswith("http:"):
- self._protocolComboBox.set_active(1)
+ self._protocolComboBox.set_active(PROTOCOL_HTTP)
l = 7
elif proto.startswith("https:"):
- self._protocolComboBox.set_active(2)
+ self._protocolComboBox.set_active(PROTOCOL_HTTPS)
l = 8
elif proto.startswith("ftp:"):
- self._protocolComboBox.set_active(3)
+ self._protocolComboBox.set_active(PROTOCOL_FTP)
l = 6
self._urlEntry.set_sensitive(True)
@@ -644,7 +656,7 @@ class SourceSpoke(NormalSpoke):
self._mirrorlistCheckbox.set_active(bool(self.data.method.mirrorlist))
elif self.data.method.method == "nfs":
self._networkButton.set_active(True)
- self._protocolComboBox.set_active(4)
+ self._protocolComboBox.set_active(PROTOCOL_NFS)
self._urlEntry.set_text("%s:%s" % (self.data.method.server,
self.data.method.dir))
self._urlEntry.set_sensitive(True)
@@ -683,16 +695,16 @@ class SourceSpoke(NormalSpoke):
return not flags.livecdInstall
def _mirror_active(self):
- return self._protocolComboBox.get_active() == 0
+ return self._protocolComboBox.get_active() == PROTOCOL_MIRROR
def _http_active(self):
- return self._protocolComboBox.get_active() in [1, 2]
+ return self._protocolComboBox.get_active() in [PROTOCOL_HTTP, PROTOCOL_HTTPS]
def _ftp_active(self):
- return self._protocolComboBox.get_active() == 3
+ return self._protocolComboBox.get_active() == PROTOCOL_FTP
def _nfs_active(self):
- return self._protocolComboBox.get_active() == 4
+ return self._protocolComboBox.get_active() == PROTOCOL_NFS
def _get_selected_partition(self):
store = self.builder.get_object("partitionStore")
--
1.8.1.2
Show replies by date
And make sure to set the sizes on all the custom toolbar buttons, too. This
makes everything a consistent size and easier to hit with the mouse.
---
pyanaconda/ui/gui/spokes/custom.glade | 4 ++++
pyanaconda/ui/gui/spokes/network.glade | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/pyanaconda/ui/gui/spokes/custom.glade
b/pyanaconda/ui/gui/spokes/custom.glade
index e400211..ea6bcd3 100644
--- a/pyanaconda/ui/gui/spokes/custom.glade
+++ b/pyanaconda/ui/gui/spokes/custom.glade
@@ -1360,6 +1360,8 @@ until you click on the main menu's 'Begin Installation'
button.</property>
</child>
<child>
<object class="GtkToolButton"
id="refreshButton">
+ <property
name="width_request">42</property>
+ <property
name="height_request">36</property>
<property
name="visible">True</property>
<property
name="can_focus">False</property>
<property name="tooltip_text"
translatable="yes">Reload storage configuration from disk.</property>
@@ -1375,6 +1377,8 @@ until you click on the main menu's 'Begin Installation'
button.</property>
</child>
<child>
<object class="GtkToolButton"
id="helpButton">
+ <property
name="width_request">42</property>
+ <property
name="height_request">36</property>
<property
name="visible">True</property>
<property
name="can_focus">False</property>
<property name="tooltip_text"
translatable="yes">Click for help.</property>
diff --git a/pyanaconda/ui/gui/spokes/network.glade
b/pyanaconda/ui/gui/spokes/network.glade
index eff4c6a..b4220ba 100644
--- a/pyanaconda/ui/gui/spokes/network.glade
+++ b/pyanaconda/ui/gui/spokes/network.glade
@@ -319,6 +319,8 @@ updates available for you.</property>
</style>
<child>
<object class="GtkToolButton"
id="add_toolbutton">
+ <property
name="width_request">42</property>
+ <property
name="height_request">36</property>
<property
name="visible">True</property>
<property
name="can_focus">False</property>
<property
name="use_underline">True</property>
@@ -331,6 +333,8 @@ updates available for you.</property>
</child>
<child>
<object class="GtkToolButton"
id="remove_toolbutton">
+ <property
name="width_request">42</property>
+ <property
name="height_request">36</property>
<property
name="visible">True</property>
<property
name="can_focus">False</property>
<property
name="use_underline">True</property>
--
1.8.1.2
Related: rhbz#895756
---
pyanaconda/errors.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/pyanaconda/errors.py b/pyanaconda/errors.py
index 815a930..d3f9ffd 100644
--- a/pyanaconda/errors.py
+++ b/pyanaconda/errors.py
@@ -21,6 +21,8 @@
import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
+from pyanaconda.ui.tui import TextUserInterface
+
__all__ = ["ERROR_RAISE", "ERROR_CONTINUE", "ERROR_RETRY",
"ErrorHandler",
"InvalidImageSizeError", "MissingImageError",
"MediaUnmountError",
@@ -267,6 +269,9 @@ class ErrorHandler(object):
kwargs["exception"] = exn
rc = _map[exn.__class__.__name__](*args, **kwargs)
+ if isinstance(self.ui, TextUserInterface):
+ self.ui.run()
+
return rc
# Create a singleton of the ErrorHandler class. It is up to the UserInterface
--
1.8.1.2
Among other things, this stops us from displaying an exception that the user
has to deal with after they get a message shown about broken dependencies.
It just quits, like we intend.
---
pyanaconda/ui/tui/hubs/progress.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pyanaconda/ui/tui/hubs/progress.py b/pyanaconda/ui/tui/hubs/progress.py
index a7d8c1b..2be443b 100644
--- a/pyanaconda/ui/tui/hubs/progress.py
+++ b/pyanaconda/ui/tui/hubs/progress.py
@@ -91,6 +91,8 @@ class ProgressHub(TUIHub):
if self._stepped:
print('')
return True
+ elif code == progressQ.PROGRESS_CODE_QUIT:
+ sys.exit(args[0])
q.task_done()
return True
--
1.8.1.2
These all look good to me.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic