Fix pylint and travis errors

This commit is contained in:
donoban 2018-05-20 21:30:50 +02:00
parent edbc4c4469
commit 8327e32e1f
No known key found for this signature in database
GPG Key ID: 141310D8E3ED08A5
2 changed files with 33 additions and 28 deletions

View File

@ -29,6 +29,8 @@ import subprocess
import time import time
from datetime import datetime, timedelta from datetime import datetime, timedelta
import traceback import traceback
import threading
from pydbus import SessionBus from pydbus import SessionBus
from qubesadmin import Qubes from qubesadmin import Qubes
@ -37,6 +39,8 @@ from qubesadmin import exc
from PyQt4 import QtGui # pylint: disable=import-error from PyQt4 import QtGui # pylint: disable=import-error
from PyQt4 import QtCore # pylint: disable=import-error from PyQt4 import QtCore # pylint: disable=import-error
from qubesmanager.about import AboutDialog
from . import ui_qubemanager # pylint: disable=no-name-in-module from . import ui_qubemanager # pylint: disable=no-name-in-module
from . import thread_monitor from . import thread_monitor
from . import table_widgets from . import table_widgets
@ -45,9 +49,6 @@ from . import global_settings
from . import restore from . import restore
from . import backup from . import backup
from . import log_dialog from . import log_dialog
import threading
from qubesmanager.about import AboutDialog
class SearchBox(QtGui.QLineEdit): class SearchBox(QtGui.QLineEdit):
@ -138,7 +139,7 @@ class VmRowInTable(object):
widget will extract the data from VM object widget will extract the data from VM object
:return: None :return: None
""" """
self.info_widget.update_vm_state(self.vm) self.info_widget.update_vm_state()
self.template_widget.update() self.template_widget.update()
self.netvm_widget.update() self.netvm_widget.update()
self.internal_widget.update() self.internal_widget.update()
@ -379,25 +380,25 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
# Connect dbus events # Connect dbus events
self.bus = SessionBus() self.bus = SessionBus()
manager = self.bus.get("org.qubes.DomainManager1") manager = self.bus.get("org.qubes.DomainManager1")
manager.DomainAdded.connect(self.OnDomainAdded) manager.DomainAdded.connect(self.onDomainAdded)
manager.DomainRemoved.connect(self.OnDomainRemoved) manager.DomainRemoved.connect(self.onDomainRemoved)
manager.Failed.connect(self.OnFailed) manager.Failed.connect(self.onFailed)
manager.Halted.connect(self.OnHalted) manager.Halted.connect(self.onHalted)
manager.Halting.connect(self.OnHalting) manager.Halting.connect(self.onHalting)
manager.Starting.connect(self.OnStarting) manager.Starting.connect(self.onStarting)
manager.Started.connect(self.OnStarted) manager.Started.connect(self.onStarted)
# Check Updates Timer # Check Updates Timer
timer = QtCore.QTimer(self) timer = QtCore.QTimer(self)
timer.timeout.connect(self.CheckUpdates) timer.timeout.connect(self.checkUpdates)
timer.start(1000 * 30) # 30s timer.start(1000 * 30) # 30s
def CheckUpdates(self): def checkUpdates(self):
for vm in self.qubes_app.domains: for vm in self.qubes_app.domains:
if vm.klass == 'TemplateVM': if vm.klass == 'TemplateVM':
self.vms_in_table[vm.qid].update() self.vms_in_table[vm.qid].update()
def OnDomainAdded(self, manager, domain): def onDomainAdded(self, _, domain):
#needs to clear cache #needs to clear cache
self.qubes_app.domains.clear_cache() self.qubes_app.domains.clear_cache()
qid = int(domain.split('/')[-1]) qid = int(domain.split('/')[-1])
@ -416,7 +417,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
self.table.setSortingEnabled(True) self.table.setSortingEnabled(True)
def OnDomainRemoved(self, manager, domain): def onDomainRemoved(self, _, domain):
#needs to clear cache #needs to clear cache
self.qubes_app.domains.clear_cache() self.qubes_app.domains.clear_cache()
@ -433,14 +434,14 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
self.table.removeRow(row_index) self.table.removeRow(row_index)
del self.vms_in_table[qid] del self.vms_in_table[qid]
def OnFailed(self, manager, domain): def onFailed(self, _, domain):
qid = int(domain.split('/')[-1]) qid = int(domain.split('/')[-1])
self.vms_in_table[qid].update() self.vms_in_table[qid].update()
if self.vms_in_table[qid].vm == self.get_selected_vm(): if self.vms_in_table[qid].vm == self.get_selected_vm():
self.table_selection_changed() self.table_selection_changed()
def OnHalted(self, manager, domain): def onHalted(self, _, domain):
qid = int(domain.split('/')[-1]) qid = int(domain.split('/')[-1])
self.vms_in_table[qid].update() self.vms_in_table[qid].update()
@ -454,21 +455,21 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
if vm.klass == 'AppVM': if vm.klass == 'AppVM':
self.vms_in_table[vm.qid].update() self.vms_in_table[vm.qid].update()
def OnHalting(self, manager, domain): def onHalting(self, _, domain):
qid = int(domain.split('/')[-1]) qid = int(domain.split('/')[-1])
self.vms_in_table[qid].update() self.vms_in_table[qid].update()
if self.vms_in_table[qid].vm == self.get_selected_vm(): if self.vms_in_table[qid].vm == self.get_selected_vm():
self.table_selection_changed() self.table_selection_changed()
def OnStarted(self, manager, domain): def onStarted(self, _, domain):
qid = int(domain.split('/')[-1]) qid = int(domain.split('/')[-1])
self.vms_in_table[qid].update() self.vms_in_table[qid].update()
if self.vms_in_table[qid].vm == self.get_selected_vm(): if self.vms_in_table[qid].vm == self.get_selected_vm():
self.table_selection_changed() self.table_selection_changed()
def OnStarting(self, manager, domain): def onStarting(self, _, domain):
qid = int(domain.split('/')[-1]) qid = int(domain.split('/')[-1])
self.vms_in_table[qid].update() self.vms_in_table[qid].update()

View File

@ -18,10 +18,10 @@
# #
# You should have received a copy of the GNU Lesser General Public License along # You should have received a copy of the GNU Lesser General Public License along
# with this program; if not, see <http://www.gnu.org/licenses/>. # with this program; if not, see <http://www.gnu.org/licenses/>.
import datetime
from PyQt4 import QtGui # pylint: disable=import-error from PyQt4 import QtGui # pylint: disable=import-error
from PyQt4 import QtCore # pylint: disable=import-error from PyQt4 import QtCore # pylint: disable=import-error
import datetime
# pylint: disable=too-few-public-methods # pylint: disable=too-few-public-methods
power_order = QtCore.Qt.DescendingOrder power_order = QtCore.Qt.DescendingOrder
@ -253,7 +253,7 @@ class VmInfoWidget(QtGui.QWidget):
self.table_item = self.VmInfoItem(self.upd_info.table_item, vm) self.table_item = self.VmInfoItem(self.upd_info.table_item, vm)
def update_vm_state(self, vm): def update_vm_state(self):
self.on_icon.update() self.on_icon.update()
self.upd_info.update_outdated() self.upd_info.update_outdated()
@ -391,7 +391,8 @@ class VmUpdateInfoWidget(QtGui.QWidget):
outdated_state = "outdated" outdated_state = "outdated"
break break
elif self.vm.klass == 'TemplateVM' and self.vm.features.get('updates-available', False): elif self.vm.klass == 'TemplateVM' and \
self.vm.features.get('updates-available', False):
outdated_state = 'update' outdated_state = 'update'
self.update_status_widget(outdated_state) self.update_status_widget(outdated_state)
@ -427,11 +428,14 @@ class VmUpdateInfoWidget(QtGui.QWidget):
self.layout().removeWidget(self.icon) self.layout().removeWidget(self.icon)
del self.icon del self.icon
if icon_path is not None: if self.show_text:
self.icon = VmIconWidget(icon_path, True, 0.7) self.label.setText(label_text)
self.icon.setToolTip(tooltip_text) else:
self.layout().addWidget(self.icon, alignment=QtCore.Qt.AlignCenter) if icon_path is not None:
self.icon.setVisible(True) self.icon = VmIconWidget(icon_path, True, 0.7)
self.icon.setToolTip(tooltip_text)
self.layout().addWidget(self.icon, alignment=QtCore.Qt.AlignCenter)
self.icon.setVisible(True)
class VmSizeOnDiskItem(QtGui.QTableWidgetItem): class VmSizeOnDiskItem(QtGui.QTableWidgetItem):
def __init__(self, vm): def __init__(self, vm):