Skip to content

Commit

Permalink
remove spinner code
Browse files Browse the repository at this point in the history
Tools should be written to be fast enough that spinners don't become necessary.
  • Loading branch information
qubesuser committed Nov 10, 2017
1 parent e5402e4 commit d8246fb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 180 deletions.
8 changes: 0 additions & 8 deletions doc/manpages/qvm-ls.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ Options

Decrease verbosity.

.. option:: --spinner

Have a spinner spinning while the spinning mainloop spins new table cells.

.. option:: --no-spinner

No spinner today.

Authors
-------
| Joanna Rutkowska <joanna at invisiblethingslab dot com>
Expand Down
147 changes: 0 additions & 147 deletions qubesadmin/spinner.py

This file was deleted.

27 changes: 2 additions & 25 deletions qubesadmin/tools/qvm_ls.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import textwrap

import qubesadmin
import qubesadmin.spinner
import qubesadmin.tools
import qubesadmin.utils
import qubesadmin.vm
Expand Down Expand Up @@ -387,10 +386,9 @@ class Table(object):
:param qubes.Qubes app: Qubes application object.
:param list colnames: Names of the columns (need not to be uppercase).
'''
def __init__(self, app, colnames, spinner, raw_data=False):
def __init__(self, app, colnames, raw_data=False):
self.app = app
self.columns = tuple(Column.columns[col.upper()] for col in colnames)
self.spinner = spinner
self.raw_data = raw_data

def get_head(self):
Expand All @@ -402,7 +400,6 @@ def get_row(self, vm):
ret = []
for col in self.columns:
ret.append(col.cell(vm))
self.spinner.update()
return ret

def write_table(self, stream=sys.stdout):
Expand All @@ -413,12 +410,9 @@ def write_table(self, stream=sys.stdout):

table_data = []
if not self.raw_data:
self.spinner.show('please wait...')
table_data.append(self.get_head())
self.spinner.update()
for vm in sorted(self.app.domains):
table_data.append(self.get_row(vm))
self.spinner.hide()
qubesadmin.tools.print_table(table_data, stream=stream)
else:
for vm in sorted(self.app.domains):
Expand Down Expand Up @@ -529,16 +523,6 @@ def get_parser():
help='Display specify data of specified VMs. Intended for '
'bash-parsing.')

parser.add_argument('--spinner',
action='store_true', dest='spinner',
help='reenable spinner')

parser.add_argument('--no-spinner',
action='store_false', dest='spinner',
help='disable spinner')

parser.set_defaults(spinner=True)

# parser.add_argument('--conf', '-c',
# action='store', metavar='CFGFILE',
# help='Qubes config file')
Expand Down Expand Up @@ -571,15 +555,8 @@ def main(args=None, app=None):
if col.upper() not in Column.columns:
PropertyColumn(col.lower())

if args.spinner:
# we need Enterprise Edition™, since it's the only one that detects TTY
# and uses dots if we are redirected somewhere else
spinner = qubesadmin.spinner.QubesSpinnerEnterpriseEdition(sys.stderr)
else:
spinner = qubesadmin.spinner.DummySpinner(sys.stderr)

args.app.domains.get_all_data()
table = Table(args.app, columns, spinner)
table = Table(args.app, columns)
table.write_table(sys.stdout)

return 0
Expand Down

0 comments on commit d8246fb

Please sign in to comment.