hide upgrade button when not needed

pull/2/head
Hans P. Möller 4 years ago
parent 7e06da13ab
commit 148e751176

@ -78,8 +78,10 @@ class Dialog(QWidget):
vbox.addWidget(self.tw) vbox.addWidget(self.tw)
vbox.addLayout(hbox) vbox.addLayout(hbox)
self.tw.setVisible(False)
if self.upg_path is None: if self.upg_path is None:
self.upgradeBtn.setVisible(False) self.buttonBox.button(QDialogButtonBox.Apply).setVisible(False)
self.setLayout(vbox) self.setLayout(vbox)
self.setGeometry(300, 300, 500, 150) self.setGeometry(300, 300, 500, 150)
@ -87,6 +89,7 @@ class Dialog(QWidget):
self.center() self.center()
if self.upgrades > 0: if self.upgrades > 0:
self.tw.setVisible(True)
self.depcache.upgrade(True) # True for non safe. self.depcache.upgrade(True) # True for non safe.
pkg_install = list() pkg_install = list()
pkg_upgrade = list() pkg_upgrade = list()
@ -133,7 +136,7 @@ class Dialog(QWidget):
if self.reboot_required: if self.reboot_required:
if text == "": if text == "":
text = _("Reboot required") text = _("Reboot required")
self.upgradeBtn.setVisible(False) self.buttonBox.button(QDialogButtonBox.Apply).setVisible(False)
else: else:
text += "\n" text += "\n"
text += _("Reboot required") text += _("Reboot required")
@ -159,15 +162,10 @@ class Dialog(QWidget):
''' starts upgrade process ''' ''' starts upgrade process '''
self.label.setText(_("Upgrading...")) self.label.setText(_("Upgrading..."))
# TODO maybe open another thread so notifier won't freeze # TODO maybe open another thread so notifier won't freeze
if self.upg_path == "terminal": cmd = ['lxqt-sudo', self.upg_path, '--full-upgrade']
# cmd = ['qterminal', '-e', 'sudo', 'apt', 'dist-upgrade'] self.buttonBox.button(QDialogButtonBox.Apply).setEnabled(False)
cmd = ['qterminal', '-e', './upg.sh'] self.buttonBox.button(QDialogButtonBox.Apply).setVisible(False)
else: self.tw.setVisible(False)
cmd = ['lxqt-sudo', self.upg_path, '--full-upgrade']
# process = subprocess.Popen(self.upg_path)
# process = subprocess.Popen(cmd, shell=True)
self.upgradeBtn.setVisible(False)
self.upgradeBtn.setEnabled(False)
process = subprocess.Popen(cmd) process = subprocess.Popen(cmd)
process.wait() process.wait()

Loading…
Cancel
Save