add version info

pull/2/head
Hans P. Möller 4 years ago
parent cea3cb0229
commit 78f3fb3d61

@ -93,36 +93,40 @@ class Dialog(QWidget):
pkg_delete = list() pkg_delete = list()
for p in self.cache.packages: for p in self.cache.packages:
if self.depcache.marked_delete(p): if self.depcache.marked_delete(p):
pkg_delete.append(p.name) pkg_delete.append(p)
elif self.depcache.marked_install(p): elif self.depcache.marked_install(p):
pkg_install.append(p.name) pkg_install.append([p, self.depcache.get_candidate_ver(p)])
elif self.depcache.marked_upgrade(p): elif self.depcache.marked_upgrade(p):
pkg_upgrade.append(p.name) pkg_upgrade.append([p, self.depcache.get_candidate_ver(p)])
text = _("There are upgrades available. Do you want to do a system " text = _("There are upgrades available. Do you want to do a system"
"upgrade?") " upgrade?")
text += "\n" text += "\n"
text += _("This will mean packages could be upgraded, installed, or " text += _("This will mean packages could be upgraded, installed or"
"removed.") " removed.")
if len(pkg_delete) > 0: if len(pkg_delete) > 0:
toDelete = QTreeWidgetItem([_('Remove')]) toDelete = QTreeWidgetItem([_('Remove')])
for p in pkg_delete: for p in pkg_delete:
td_child = QTreeWidgetItem([p]) td_child = QTreeWidgetItem(p.name)
toDelete.addChild(td_child) toDelete.addChild(td_child)
toDelete.setIcon(0, QIcon.fromTheme("edit-delete")) toDelete.setIcon(0, QIcon.fromTheme("edit-delete"))
self.tw.addTopLevelItem(toDelete) self.tw.addTopLevelItem(toDelete)
if len(pkg_install) > 0: if len(pkg_install) > 0:
toInstall = QTreeWidgetItem([_('Install')]) toInstall = QTreeWidgetItem([_('Install')])
for p in pkg_install: for p in pkg_install:
td_child = QTreeWidgetItem([p]) td_child = QTreeWidgetItem([p[0].name])
toInstall.addChild(td_child) toInstall.addChild(td_child)
toInstall.setIcon(0, QIcon.fromTheme("system-software-install")) td_child.addChild(QTreeWidgetItem([p[1].ver_str]))
toInstall.setIcon(0,
QIcon.fromTheme("system-software-install"))
self.tw.addTopLevelItem(toInstall) self.tw.addTopLevelItem(toInstall)
if len(pkg_upgrade) > 0: if len(pkg_upgrade) > 0:
toUpgrade = QTreeWidgetItem([_('Upgrade')]) toUpgrade = QTreeWidgetItem([_('Upgrade')])
for p in pkg_upgrade: for p in pkg_upgrade:
td_child = QTreeWidgetItem([p]) td_child = QTreeWidgetItem([p[0].name])
toUpgrade.addChild(td_child) toUpgrade.addChild(td_child)
td_child.addChild(QTreeWidgetItem(
[p[0].current_ver.ver_str + " -> " + p[1].ver_str]))
toUpgrade.setIcon(0, QIcon.fromTheme("system-software-update")) toUpgrade.setIcon(0, QIcon.fromTheme("system-software-update"))
self.tw.addTopLevelItem(toUpgrade) self.tw.addTopLevelItem(toUpgrade)
@ -150,7 +154,8 @@ class Dialog(QWidget):
app.quit() app.quit()
def call_upgrade(self, btnClicked): def call_upgrade(self, btnClicked):
if(self.buttonBox.buttonRole(btnClicked) == QDialogButtonBox.ApplyRole): if(self.buttonBox.buttonRole(btnClicked) ==
QDialogButtonBox.ApplyRole):
''' 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
@ -182,6 +187,7 @@ class Dialog(QWidget):
class App(QApplication): class App(QApplication):
'''application''' '''application'''
def __init__(self, upgrades, security_upgrades, reboot_required, upg_path, def __init__(self, upgrades, security_upgrades, reboot_required, upg_path,
*args): *args):
QApplication.__init__(self, *args) QApplication.__init__(self, *args)
@ -199,8 +205,8 @@ def main(args, upgrades, security_upgrades, reboot_required, upg_path):
if __name__ == "__main__": if __name__ == "__main__":
localesApp ="lubuntu-update-notifier" localesApp = "lubuntu-update-notifier"
localesDir ="/usr/share/locale" localesDir = "/usr/share/locale"
gettext.bindtextdomain(localesApp, localesDir) gettext.bindtextdomain(localesApp, localesDir)
gettext.textdomain(localesApp) gettext.textdomain(localesApp)
_ = gettext.gettext _ = gettext.gettext

Loading…
Cancel
Save