def connect(self, rowid):
"""
Description: Whenever the user clicks on the 'connect' row, this method will make
sure the VM status is up and only then will call the connect2machine method.
Arguments: The row id that has been clicked. This relationship is stored using the VmData class.
Returns: Nothing
"""
self.lastclick = int(time()) # Last click timestamp update
vmid = self.vmdata[rowid].vmid
vmname = self.vmdata[rowid].vmname
vmstatus = self.vmdata[rowid].vmstatus
if vmstatus != 'up':
QMessageBox.warning(None, _('apptitle') + ': ' + _('warning'), _('cannot_connect_if_vm_not_up'))
return
if vmname in self.openviewer_vms:
QMessageBox.critical(None, _('apptitle') + ': ' + _('error'), _('cannot_open_more_viewer_sessions'))
return
self.openviewer_vms.append(vmname)
self.refresh_grid() # Enforce a dashboard reload to make the icon refresh
self.connect2machine(vmid, vmname)
评论列表
文章目录