Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manager revival #52

Merged
merged 9 commits into from
Jan 12, 2018
Merged

Manager revival #52

merged 9 commits into from
Jan 12, 2018

Conversation

marmarta
Copy link
Member

@marmarta marmarta commented Jan 8, 2018

Revived old Qubes Manager in a slimmer, lighter, less horrifyingly complex form.

  • Removed info on CPU and Memory usage
  • Added "refresh" button
  • Renamed "VM" to "Qube" everywhere
  • Cleaned-up the code
  • Renamed the thing to "Qube Manager"

Remaining recommended fixes:

  • replace untidy multitude of QtGui Items with one generic type
  • restore Qubes Network functionality
  • add Boot From Device action (and easy way to install windows tool from there)

fixes QubesOS/qubes-issues#2966
QubesOS/qubes-issues#2132

Everything that should work works. Further improvements that would be nice:
- replace untidy multitude of QtGui Items with one generic type
- restore Qubes Network functionality
- add Boot From Device action (and easy way to install windows tool from there)

fixes QubesOS/qubes-issues#2966
QubesOS/qubes-issues#2132
Renamed 'VM' to 'Qube' in the user interface for Qube Manager.
Removed errors discovered by pylint, or told it to be quiet when needed.
Changed "size on disk" widget to display only two decimal places.
Surprisingly, it has not been touched since 3.2. It should work now.
self.__init_log_text__()

def __init_log_text__(self):
self.displayed_text = ""
log = open(self.log_path)
log.seek(0, os.SEEK_END)
log.seek(0, clipboard.os.SEEK_END)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.SEEK_END

log.seek(-LOG_DISPLAY_SIZE, os.SEEK_END)
self.displayed_text = self.tr(
"(Showing only last %d bytes of file)\n") % LOG_DISPLAY_SIZE
log.seek(-LOG_DISPLAY_SIZE, clipboard.os.SEEK_END)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here.

vm = self.vm
vm_is_running = vm.is_running()
vm_start_time = datetime.fromtimestamp(
float(getattr(vm, 'start_time', None)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None isn't the best choice here - float(None) throws TypeError. Alternatively wrap this in try/except TypeError.

vm_is_running = vm.is_running()
vm_start_time = datetime.fromtimestamp(
float(getattr(vm, 'start_time', None)))
if vm_is_running and vm_start_time \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you check if vm_start_time is not false (so, not None, or 0 in practice). So, maybe use some of those if start_time attribute is inaccessible.

# pylint: disable=unused-argument
super(VmManagerWindow, self).__init__()
self.setupUi(self)
self.toolbar = self.toolBar
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?


row_no += 1

self.table.setRowCount(row_no)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again?

for row_no in range(self.table.rowCount()):
widget = self.table.cellWidget(row_no,
self.columns_indices["State"])
show = (self.search in widget.vm.name or not self.search)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not self.search is always false here, see top if in the function.

and vm.klass != 'AdminVM')
self.action_restartvm.setEnabled(
vm.is_running() and vm.get_power_state() != "Paused"
and vm.klass != 'AdminVM' and vm.klass != 'DisposableVM')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DispVM

and vm.klass != 'AdminVM')

self.action_appmenus.setEnabled(
vm.klass != 'AdminVM' and vm.klass != 'DisposableMV'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DispVM


def update(self):
if self.previous_power_state != self.vm.last_power_state:
self.previous_power_state = self.vm.get_power_state()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks wrong, you check for "previous" value a line below.

Because I forgot it the first time round. Sorry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No GUI VM Updater in R4.0-rc1
2 participants