Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions rapid/ui/qt/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def run(self):
elif os.name == 'posix':
main.init(os.path.expanduser('~/.spring'), ui)
else:
print 'No data directory specified. Specify one using either --datadir or --unitsync.'
print
print('No data directory specified. Specify one using either --datadir or --unitsync.')
print()
installed,available = split_on_condition( main.rapid.packages, lambda p: p.installed )
self.mainWidget.reload( installed,available )
#progress.destroy()
Expand Down Expand Up @@ -70,11 +70,11 @@ def install_single(self, p, dep = False):
for d in p.dependencies:
self.install_single(d, True)
if not p.installed:
print ['Installing: ', 'Installing dependency: '][int(dep)] + p.name
print(['Installing: ', 'Installing dependency: '][int(dep)] + p.name)
p.install(self)
print
print()
elif not dep:
print 'Already installed: ' + p.name
print('Already installed: ' + p.name)

def __call__(self, value ):
self.emit( QtCore.SIGNAL("incrementValue"), value )
Expand Down Expand Up @@ -154,7 +154,7 @@ def doubleClicked(self,modelIndex):
QtGui.QMessageBox.information( self.parent, "Done","%s was removed"%p.name )
self.sourceModel.reload()
except Exception, e:
print e
print(e)
QtGui.QMessageBox.critical( self.parent, "Error", "Removing %s failed\n%s"%(p.name,str(e)) )


Expand All @@ -168,7 +168,7 @@ def __init__(self,parent):
def doubleClicked(self,modelIndex):
item = self.sourceModel.itemFromIndex( self.proxyModel.mapToSource( modelIndex ) )
tag = str(item.text())
print 'downloading ',tag
print('downloading ',tag)
self.dl = DownloadDialog(self.parent,tag)
self.dl.show()
self.connect( self.dl.dt, QtCore.SIGNAL("downloadComplete"), self.parent.reload, QtCore.Qt.QueuedConnection )
Expand Down
24 changes: 12 additions & 12 deletions rapid/ui/text/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def _to_i_bounds_check(self, text, lower, upper):

def choose_many(self, header, options, question):
""" Let the user choose multiple options from a list."""
print header
print(header)
for i in range(len(options)):
print '%2i. %s' % (i + 1, options[i])
print('%2i. %s' % (i + 1, options[i]))
which = raw_input(question + ' [enter number(s) or "all"]: ')
if which.lower().strip() == 'all':
return options
Expand All @@ -30,7 +30,7 @@ def choose_many(self, header, options, question):
n = len(options)
which = [self._to_i_bounds_check(x, 1, n) - 1 for x in which]
except (ValueError, IndexError) as e:
print type(e).__name__ + ':', str(e)
print(type(e).__name__ + ':', str(e))
return []
return [options[x] for x in which]

Expand All @@ -46,11 +46,11 @@ def select(self, noun, needle, haystack):
selected = self._select_core(needle, haystack)

if len(selected) == 0:
print 'No %ss matching "%s" found.' % (noun, needle)
print('No %ss matching "%s" found.' % (noun, needle))
return selected

if len(selected) >= 100:
print '100 or more %ss matching "%s" found, please narrow your search.' % (noun, needle)
print('100 or more %ss matching "%s" found, please narrow your search.' % (noun, needle))
return []

if len(selected) > 1:
Expand All @@ -60,18 +60,18 @@ def select(self, noun, needle, haystack):

def output_header(self, text):
""" Output the header of a list/table."""
print text
print(text)

def output_detail(self, text):
""" Output a detail row of a list/table.
TODO: Interface should be improved."""
print text
print(text)

def important_warning(self, *lines):
""" Display an important warning to the user."""
print
print '#' * 79
print()
print('#' * 79)
for line in lines:
print '# %-75s #' % line.center(75)
print '#' * 79
print
print('# %-75s #' % line.center(75))
print('#' * 79)
print()
20 changes: 10 additions & 10 deletions rapid/ui/text/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def req_arg():
""" Returns the next positional argument or
displays an error and exits if there are no arguments left."""
if len(args) < 1:
print 'Not enough arguments to operation.'
print
print('Not enough arguments to operation.')
print()
usage()
return args.pop(0)

Expand All @@ -94,10 +94,10 @@ def opt_arg():
# Only the left side is expanded by git-archive, so when the left side
# and the right side differ we are running a real release.
if '$Format:%h%d$'[1:-1] == 'Format:%h%d':
print 'No version information available.',
print 'Are you using a development version?'
print('No version information available.')
print('Are you using a development version?')
else:
print 'Exported from git commit: $Format:%h%d$'
print('Exported from git commit: $Format:%h%d$')
sys.exit(0)

if len(args) < 1:
Expand All @@ -118,8 +118,8 @@ def opt_arg():
elif os.name == 'posix':
init(os.path.expanduser('~/.spring'), ui)
else:
print 'No data directory specified. Specify one using either --datadir or --unitsync.'
print
print('No data directory specified. Specify one using either --datadir or --unitsync.')
print()
usage()

# Loop conditions are at the end.
Expand All @@ -144,7 +144,7 @@ def opt_arg():
if len(args) == 0:
break
else:
print '---'
print('---')

# Commands which have a fixed number of arguments.
if verb == 'list-packages':
Expand All @@ -166,6 +166,6 @@ def opt_arg():
elif verb == 'make-sdd':
make_sdd(req_arg(), req_arg())
elif not handled:
print 'Unknown operation: ' + verb
print
print('Unknown operation: ' + verb)
print()
usage()
2 changes: 1 addition & 1 deletion rapid/ui/text/progressbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __call__(self, value):
carriage return first, so it will overwrite the current line in
stdout."""
if self.amount < self.max:
print '\r',
print('\r')
self.update_amount(self.amount + value)
sys.stdout.write(str(self))
sys.stdout.write(self.amount < self.max and "\r" or "\n")
Expand Down
10 changes: 5 additions & 5 deletions rapid/unitsync/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def generate_locations():
if type == _winreg.REG_SZ:
yield value
else:
print 'key of unknown type'
print('key of unknown type')
except WindowsError as e:
print "Registry key not found: " + str(e)
print("Registry key not found: " + str(e))
program_files = os.getenv('ProgramFiles')
if program_files:
for filename in filenames:
Expand Down Expand Up @@ -86,13 +86,13 @@ def get_writable_data_directory():
def test():
# Quick test.
for location in generate_locations():
print location
print(location)
unitsync = locate_unitsync()
# This is not available in older versions of unitsync.
print 'Has GetMapDescription?', unitsync.has('GetMapDescription')
print('Has GetMapDescription?', unitsync.has('GetMapDescription'))
# Test main interface.
data_directory = get_writable_data_directory()
print '===>', data_directory, '<==='
print('===>', data_directory, '<===')


if __name__ == '__main__':
Expand Down
6 changes: 3 additions & 3 deletions rapid/unitsync/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ def __init__(self, location):
if os.path.isfile('./unitsync_api.h'):
argv.append('./unitsync_api.h')
else:
print 'must be passed unitsync_api.h to generate bindings'
print 'if on windows, you can simply drag the file onto this one'
print('must be passed unitsync_api.h to generate bindings')
print('if on windows, you can simply drag the file onto this one')
time.sleep(30)
sys.exit(1)

name = argv[1]
if not os.path.isfile(name):
print '%s is not a valid file' % name
print('%s is not a valid file' % name)
time.sleep(30)
sys.exit(1)

Expand Down
4 changes: 2 additions & 2 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ def main():
sys.path = [os.path.normpath(os.path.dirname(os.path.realpath(__file__)))] + sys.path

if len(sys.argv) < 2:
print """Usage: %s foo.py [arguments...]'
print("""Usage: %s foo.py [arguments...]'
Runs foo.py as if it was run directly, except that sys.path is modified so that
development copies of modules (relative to this script) are picked up first.""" % sys.argv[0]
development copies of modules (relative to this script) are picked up first.""" % sys.argv[0])
sys.exit(1)

# Cloak =)
Expand Down