Skip to content

Commit

Permalink
Prefer string format to concatenation
Browse files Browse the repository at this point in the history
  • Loading branch information
laurelmay committed Dec 27, 2017
1 parent 3f1a87d commit 62e02ae
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions roles/task-shortcuts/files/uug-ansible-wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# Map of course names to the Ansible tags
courses = {'CS 101': 'cs101', 'CS 149': 'cs149', 'CS 159': 'cs159',
'CS 261': 'cs261', 'CS 354': 'cs354'}
user_config_path = os.environ['HOME'] + "/.config/vm_config"
user_config_path = os.path.join(os.environ['HOME'], ".config", "vm_config")
user_config = {}
release = None
url = None
Expand Down Expand Up @@ -85,16 +85,16 @@ def __init__(self):
# dictionaries do not guarantee that order is preserved
for (course, tag) in sorted(courses.items()):
checkbox = Gtk.CheckButton(course)
checkbox.set_tooltip_text("Configure for " + course)
checkbox.set_tooltip_text("Configure for %s" % course)
checkbox.connect("toggled", self.on_button_toggled, tag)
courses_box.pack_start(checkbox, False, False, 0)
vbox.pack_start(courses_box, False, False, 0)

# Add informational labels to the bottom of the window
label_box = Gtk.Box(spacing=6)
url_label = Gtk.Label("URL: " + url)
url_label = Gtk.Label("URL: %s" % url)
label_box.pack_start(url_label, False, False, 6)
branch_label = Gtk.Label("Branch: " + release)
branch_label = Gtk.Label("Branch: %s" % release)
label_box.pack_start(branch_label, False, False, 6)
vbox.pack_end(label_box, False, False, 0)

Expand Down Expand Up @@ -128,8 +128,8 @@ def sub_command_exited(self, widget, exit_status):
self.cancel_button.set_sensitive(True)
self.run_button.set_sensitive(True)
if exit_status == 0:
success_msg = "Your machine has been configured for: " + \
",".join(tags)
success_msg = "Your machine has been configured for: %s" \
% (",".join(tags))
show_dialog(self, Gtk.MessageType.INFO, Gtk.ButtonsType.OK,
"Complete", success_msg)
# 65280 should be the exit code if the gksudo dialog is dismissed
Expand All @@ -144,7 +144,7 @@ def sub_command_exited(self, widget, exit_status):
" configuration tasks. Please try again." \
"\nIf this issue continues to occur, copy" \
" /opt/vmtools/logs/last_run.log and" \
" <a href='" + url + "'>create an issue</a>"
" <a href='%s'>create an issue</a>" % (url)
show_dialog(self, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK,
"Error", ansible_err_msg)

Expand Down Expand Up @@ -273,11 +273,10 @@ def invalid_branch(parent, release, url):
"""Displays a dialog if the branch choses does not exist on the remote"""
bad_branch_msg = "The release chosen does not exist at the project URL." \
" Please check the settings listed below and try again." \
"\nRelease: " + release + "\nURL: " + url + \
"\nIf you're using a current release of Linux Mint, you" \
" may submit" \
" <a href='" + url + "'>an issue</a> requesting support" \
" for the release list above."
"\nRelease: %s\nURL: %s\nIf you're using a current"\
" release of Linux Mint, you may submit"\
" <a href='%s'>an issue</a> requesting support for the" \
" release listed above" % (release, url, url)
show_dialog(parent, Gtk.MessageType.ERROR, Gtk.ButtonsType.CANCEL,
"Invalid Release", bad_branch_msg)
Gtk.main_quit()
Expand Down

0 comments on commit 62e02ae

Please sign in to comment.