[Merge] lp:~kubuntu-packagers/ubuntu-release-upgrader/qt5 into lp:ubuntu-release-upgrader
Rohan Garg
rohan16garg at gmail.com
Wed Aug 6 14:31:40 UTC 2014
Generally looks alright to me.
Diff comments:
> === modified file 'DistUpgrade/DistUpgradeFetcherKDE.py'
> --- DistUpgrade/DistUpgradeFetcherKDE.py 2014-05-02 13:07:42 +0000
> +++ DistUpgrade/DistUpgradeFetcherKDE.py 2014-08-05 13:50:46 +0000
> @@ -2,6 +2,7 @@
> # -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
> #
> # Copyright (c) 2008 Canonical Ltd
> +# Copyright (c) 2014 Harald Sitter <apachelogger at kubuntu.org>
> #
> # Author: Jonathan Riddell <jriddell at ubuntu.com>
> #
> @@ -18,58 +19,100 @@
> # You should have received a copy of the GNU General Public License
> # along with this program. If not, see <http://www.gnu.org/licenses/>.
>
> -from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineOptions, KCmdLineArgs
> -from PyKDE4.kdeui import KIcon, KMessageBox, KApplication, KStandardGuiItem
> -from PyQt4.QtCore import QDir, QTimer
> -from PyQt4.QtGui import QDialog, QDialogButtonBox
> -from PyQt4 import uic
> +try:
> + # 14.04 has a broken pyqt5, so don't even try to import it and require
> + # pyqt4.
> + # In 14.04 various signals in pyqt5 can not be connected because it thinks
> + # the signal does not exist or has an incompatible signature. Since this
> + # potentially renders the GUI entirely broken and pyqt5 was not actively
> + # used back then it is fair to simply require qt4 on trusty systems.
> + from .utils import get_dist
> + if get_dist() == 'trusty':
> + raise ImportError
> +
> + from PyQt5 import uic
> + from PyQt5.QtCore import *
> + from PyQt5.QtGui import *
> + from PyQt5.QtWidgets import *
> +except ImportError:
> + from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineOptions, KCmdLineArgs
> + from PyKDE4.kdeui import KIcon, KMessageBox, KApplication, KStandardGuiItem
> + from PyQt4.QtCore import QDir, QTimer
> + from PyQt4.QtGui import QDialog, QDialogButtonBox
> + from PyQt4 import uic
>
> import apt_pkg
> import sys
>
> -from .utils import inhibit_sleep, allow_sleep
> -from .DistUpgradeFetcherCore import DistUpgradeFetcherCore
> +from DistUpgrade.utils import inhibit_sleep, allow_sleep
> +from DistUpgrade.DistUpgradeFetcherCore import DistUpgradeFetcherCore
> from gettext import gettext as _
> from urllib.request import urlopen
> from urllib.error import HTTPError
> import os
>
> -from .MetaRelease import MetaReleaseCore
> import apt
>
> +from .QUrlOpener import QUrlOpener
> +
> +# TODO: uifile resolution is an utter mess and should be revised globally for
> +# both the fetcher and the upgrader GUI.
> +
> +# TODO: make this a singleton
> +# We have no globally constructed QApplication available so we need to
> +# make sure that one is created when needed. Since from a module POV
> +# this can be happening in any order of the two classes this function takes care
> +# of it for the classes, the classes only hold a ref to the qapp returned
> +# to prevent it from getting GC'd, so in essence this is a singleton scoped to
> +# the longest lifetime of an instance from the Qt GUI. Since the lifetime is
> +# pretty much equal to the process' one we might as well singleton up.
> +def _ensureQApplication():
> + if not QApplication.instance():
> + app = QApplication(["ubuntu-release-upgrader"])
> + # Try to load default Qt translations so we don't have to worry about
> + # QStandardButton translations.
> + # FIXME: make sure we dep on l10n
> + translator = QTranslator(app)
> + if PYQT_VERSION >= 0x50000:
> + translator.load(QLocale.system(), 'qt', '_', '/usr/share/qt5/translations')
> + else:
> + translator.load(QLocale.system(), 'qt', '_', '/usr/share/qt4/translations')
> + app.installTranslator(translator)
> + return app
> + return QApplication.instance()
> +
> +# Qt 5 vs. KDELibs4 compat functions
> +def _warning(text):
> + if PYQT_VERSION >= 0x50000:
> + QMessageBox.warning(None, "", text)
> + else:
> + KMessageBox.sorry(None, text, "")
> +
> +def _icon(name):
> + if PYQT_VERSION >= 0x50000:
> + return QIcon.fromTheme(name)
> + else:
> + return KIcon(name)
>
> class DistUpgradeFetcherKDE(DistUpgradeFetcherCore):
> - """A small application run by Adept to download, verify
> - and run the dist-upgrade tool"""
> -
> - def __init__(self, useDevelopmentRelease=False, useProposed=False):
> - self.useDevelopmentRelease = useDevelopmentRelease
> - self.useProposed = useProposed
> - metaRelease = MetaReleaseCore(useDevelopmentRelease, useProposed)
> - metaRelease.downloaded.wait()
> - if metaRelease.new_dist is None and __name__ == "__main__":
> - sys.exit()
> - elif metaRelease.new_dist is None:
> - return
> -
> - self.progressDialogue = QDialog()
> - if os.path.exists("fetch-progress.ui"):
> - self.APPDIR = QDir.currentPath()
> - else:
> - self.APPDIR = "/usr/share/ubuntu-release-upgrader"
> -
> - uic.loadUi(self.APPDIR + "/fetch-progress.ui", self.progressDialogue)
> - self.progressDialogue.setWindowIcon(KIcon("system-software-update"))
> - self.progressDialogue.setWindowTitle(_("Upgrade"))
> - self.progress = KDEAcquireProgressAdapter(
> - self.progressDialogue.installationProgress,
> - self.progressDialogue.installingLabel,
> - None)
> - DistUpgradeFetcherCore.__init__(self, metaRelease.new_dist,
> - self.progress)
> +
> + def __init__(self, new_dist, progress, parent, datadir):
> + DistUpgradeFetcherCore.__init__(self, new_dist, progress)
> +
> + self.app = _ensureQApplication()
> + self.app.setWindowIcon(_icon("system-software-update"))
> +
> + self.datadir = datadir
> +
> + QUrlOpener().setupUrlHandles()
> +
> + QApplication.processEvents()
>
> def error(self, summary, message):
> - KMessageBox.sorry(None, message, summary)
> + if PYQT_VERSION >= 0x50000:
> + QMessageBox.critical(None, summary, message)
> + else:
> + KMessageBox.sorry(None, message, summary)
>
> def runDistUpgrader(self):
> inhibit_sleep()
> @@ -80,73 +123,103 @@
> self.script + " --frontend=DistUpgradeViewKDE"])
> else:
> os.execv(self.script,
> - [self.script] + ["--frontend=DistUpgradeViewKDE"] +
> - self.run_options)
> + [self.script, "--frontend=DistUpgradeViewKDE" + self.run_options])
> # we shouldn't come to this point, but if we do, undo our
> # inhibit sleep
> allow_sleep()
>
> def showReleaseNotes(self):
> # FIXME: care about i18n! (append -$lang or something)
> - self.dialogue = QDialog()
> - uic.loadUi(self.APPDIR + "/dialog_release_notes.ui", self.dialogue)
> - upgradeButton = self.dialogue.buttonBox.button(QDialogButtonBox.Ok)
> - upgradeButton.setText(_("Upgrade"))
> - upgradeButton.setIcon(KIcon("dialog-ok"))
> - cancelButton = self.dialogue.buttonBox.button(QDialogButtonBox.Cancel)
> - cancelButton.setIcon(KIcon("dialog-cancel"))
> - self.dialogue.setWindowTitle(_("Release Notes"))
> - self.dialogue.show()
> - if self.new_dist.releaseNotesURI is not None:
> - uri = self._expandUri(self.new_dist.releaseNotesURI)
> + # TODO: ^ what is this supposed to mean?
> + self.dialog = QDialog()
> + uic.loadUi(self.datadir + "/dialog_release_notes.ui", self.dialog)
> + upgradeButton = self.dialog.buttonBox.button(QDialogButtonBox.Ok)
> + upgradeButton.setText(_("&Upgrade"))
> + upgradeButton.setIcon(_icon("dialog-ok"))
> + cancelButton = self.dialog.buttonBox.button(QDialogButtonBox.Cancel)
> + cancelButton.setText(_("&Cancel"))
> + cancelButton.setIcon(_icon("dialog-cancel"))
> + self.dialog.setWindowTitle(_("Release Notes"))
> + self.dialog.show()
> + if self.new_dist.releaseNotesHtmlUri is not None:
> + uri = self._expandUri(self.new_dist.releaseNotesHtmlUri)
> # download/display the release notes
> - # FIXME: add some progress reporting here
> + # TODO: add some progress reporting here
> result = None
> try:
> release_notes = urlopen(uri)
> notes = release_notes.read().decode("UTF-8", "replace")
> - self.dialogue.scrolled_notes.setText(notes)
> - result = self.dialogue.exec_()
> + self.dialog.scrolled_notes.setText(notes)
> + result = self.dialog.exec_()
> except HTTPError:
> primary = "<span weight=\"bold\" size=\"larger\">%s</span>" % \
> _("Could not find the release notes")
> secondary = _("The server may be overloaded. ")
> - KMessageBox.sorry(None, primary + "<br />" + secondary, "")
> + self._warning(primary + "<br />" + secondary)
> except IOError:
> primary = "<span weight=\"bold\" size=\"larger\">%s</span>" % \
> _("Could not download the release notes")
> secondary = _("Please check your internet connection.")
> - KMessageBox.sorry(None, primary + "<br />" + secondary, "")
> + self._warning(primary + "<br />" + secondary)
> # user clicked cancel
> if result == QDialog.Accepted:
> - self.progressDialogue.show()
> return True
> - if __name__ == "__main__":
> - KApplication.kApplication().exit(1)
> - if self.useDevelopmentRelease or self.useProposed:
> - #FIXME why does KApplication.kApplication().exit() crash but
> - # this doesn't?
> - sys.exit()
> return False
>
> + # FIXME: largely code copy from ReleaseNotesViewer which imports GTK.
> + @pyqtSlot(QUrl)
> + def openUrl(self, url):
> + url = url.toString()
> + import subprocess
> + """Open the specified URL in a browser"""
> + # Find an appropiate browser
> + if os.path.exists("/usr/bin/kde-open"):
> + command = ["kde-open", url]
> + elif os.path.exists("/usr/bin/xdg-open"):
> + command = ["xdg-open", url]
> + elif os.path.exists("/usr/bin/exo-open"):
> + command = ["exo-open", url]
> + elif os.path.exists('/usr/bin/gnome-open'):
> + command = ['gnome-open', url]
> + else:
> + command = ['x-www-browser', url]
> + # Avoid to run the browser as user root
> + if os.getuid() == 0 and 'SUDO_USER' in os.environ:
> + command = ['sudo', '-u', os.environ['SUDO_USER']] + command
> + subprocess.Popen(command)
>
> class KDEAcquireProgressAdapter(apt.progress.base.AcquireProgress):
> - def __init__(self, progress, label, parent):
> - self.progress = progress
> - self.label = label
> - self.parent = parent
> + def __init__(self, parent, datadir, label):
> + self.app = _ensureQApplication()
> + self.dialog = QDialog()
> +
> + uiFile = os.path.join(datadir, "fetch-progress.ui")
> + uic.loadUi(uiFile, self.dialog)
> + self.dialog.setWindowTitle(_("Upgrade"))
> + self.dialog.installingLabel.setText(label)
> + self.dialog.buttonBox.rejected.connect(self.abort)
> +
> + # This variable is used as return value for AcquireProgress pulses.
> + # Setting it to False will abort the Acquire and consequently the
> + # entire fetcher.
> + self._continue = True
> +
> + QApplication.processEvents()
> +
> + def abort(self):
> + self._continue = False
>
> def start(self):
> - self.label.setText(_("Downloading additional package files..."))
> - self.progress.setValue(0)
> + self.dialog.installingLabel.setText(_("Downloading additional package files..."))
> + self.dialog.installationProgress.setValue(0)
> + self.dialog.show()
>
> def stop(self):
> - pass
> + self.dialog.hide()
>
> def pulse(self, owner):
> apt.progress.base.AcquireProgress.pulse(self, owner)
> - self.progress.setValue((self.current_bytes + self.current_items) /
> - float(self.total_bytes + self.total_items))
> + self.dialog.installationProgress.setValue((self.current_bytes + self.current_items) / float(self.total_bytes + self.total_items) * 100)
> current_item = self.current_items + 1
> if current_item > self.total_items:
> current_item = self.total_items
> @@ -158,47 +231,22 @@
> else:
> label_text += _("File %s of %s") % (
> self.current_items, self.total_items)
> - self.label.setText(label_text)
> - KApplication.kApplication().processEvents()
> - return True
> + self.dialog.installingLabel.setText(label_text)
> + QApplication.processEvents()
> + return self._continue
>
> def mediaChange(self, medium, drive):
> msg = _("Please insert '%s' into the drive '%s'") % (medium, drive)
> - #change = QMessageBox.question(None, _("Media Change"), msg,
> - # QMessageBox.Ok, QMessageBox.Cancel)
> - change = KMessageBox.questionYesNo(None, _("Media Change"),
> - _("Media Change") + "<br>" + msg,
> - KStandardGuiItem.ok(),
> - KStandardGuiItem.cancel())
> - if change == KMessageBox.Yes:
> - return True
> + if PYQT_VERSION >= 0x50000:
> + change = QMessageBox.question(None, _("Media Change"), msg,
> + QMessageBox.Ok, QMessageBox.Cancel)
> + if change == QMessageBox.Ok:
> + return True
> + else:
> + change = KMessageBox.questionYesNo(None, _("Media Change"),
> + _("Media Change") + "<br>" + msg,
> + KStandardGuiItem.ok(),
> + KStandardGuiItem.cancel())
> + if change == KMessageBox.Yes:
> + return True
> return False
> -
> -if __name__ == "__main__":
> -
> - appName = "dist-upgrade-fetcher"
> - catalog = ""
> - programName = ki18n("Dist Upgrade Fetcher")
> - version = "0.3.4"
> - description = ki18n("Dist Upgrade Fetcher")
> - license = KAboutData.License_GPL
> - copyright = ki18n("(c) 2008 Canonical Ltd")
> - text = ki18n("none")
> - homePage = "https://launchpad.net/ubuntu-release-upgrader"
> - bugEmail = ""
> -
> - aboutData = KAboutData(appName, catalog, programName, version, description,
> - license, copyright, text, homePage, bugEmail)
> -
> - aboutData.addAuthor(ki18n("Jonathan Riddell"), ki18n("Author"))
> -
> - options = KCmdLineOptions()
> -
> - KCmdLineArgs.init(sys.argv, aboutData)
> - KCmdLineArgs.addCmdLineOptions(options)
> -
> - app = KApplication()
> - fetcher = DistUpgradeFetcherKDE()
> - QTimer.singleShot(10, fetcher.run)
> -
> - app.exec_()
>
> === modified file 'DistUpgrade/DistUpgradeViewKDE.py'
> --- DistUpgrade/DistUpgradeViewKDE.py 2014-05-02 13:07:42 +0000
> +++ DistUpgrade/DistUpgradeViewKDE.py 2014-08-05 13:50:46 +0000
> @@ -1,9 +1,10 @@
> # DistUpgradeViewKDE.py
> -#
> +#
> # Copyright (c) 2007 Canonical Ltd
> -#
> +# Copyright (c) 2014 Harald Sitter <apachelogger at kubuntu.org>
> +#
> # Author: Jonathan Riddell <jriddell at ubuntu.com>
> -#
> +#
> # This program is free software; you can redistribute it and/or
> # modify it under the terms of the GNU General Public License as
> # published by the Free Software Foundation; either version 2 of the
> @@ -19,13 +20,26 @@
> # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
> # USA
>
> -from PyQt4.QtCore import QUrl, Qt, SIGNAL, QTimer
> -from PyQt4.QtGui import (
> - QDesktopServices, QDialog, QPixmap, QTreeWidgetItem, QMessageBox,
> - QApplication, QTextEdit, QTextOption, QTextCursor, QPushButton,
> - QWidget, QIcon, QHBoxLayout, QLabel
> - )
> -from PyQt4 import uic
> +try:
> + # 14.04 has a broken pyqt5, so don't even try to import it and require
> + # pyqt4.
> + # In 14.04 various signals in pyqt5 can not be connected because it thinks
> + # the signal does not exist or has an incompatible signature. Since this
> + # potentially renders the GUI entirely broken and pyqt5 was not actively
> + # used back then it is fair to simply require qt4 on trusty systems.
> + from .utils import get_dist
> + if get_dist() == 'trusty':
> + raise ImportError
> +
> + from PyQt5 import uic
> + from PyQt5.QtCore import *
> + from PyQt5.QtGui import *
> + from PyQt5.QtWidgets import *
> +except ImportError:
> + from PyQt4 import uic
> + from PyQt4.QtCore import *
> + from PyQt4.QtGui import *
> + # If we still throw an exception, bounce back to Main to try another UI.
>
> import sys
> import locale
> @@ -51,14 +65,16 @@
> from .DistUpgradeGettext import gettext as _
> from .DistUpgradeGettext import unicode_gettext
>
> +from .QUrlOpener import QUrlOpener
>
> +# FIXME: what's the purpose?
> def utf8(s, errors="strict"):
> if isinstance(s, bytes):
> return s.decode("UTF-8", errors)
> else:
> return s
>
> -
> +# FIXME: what's the purpose?
> def loadUi(file, parent):
> if os.path.exists(file):
> uic.loadUi(file, parent)
> @@ -74,6 +90,7 @@
> QTextEdit.__init__(self, "", parent_frame)
> self.installProgress = installProgress
> self.setFontFamily("Monospace")
> + # FIXME: fixed font size set!!!
> self.setFontPointSize(8)
> self.setWordWrapMode(QTextOption.NoWrap)
> self.setUndoRedoEnabled(False)
> @@ -298,7 +315,8 @@
> dialogue.textview_error.show()
> else:
> dialogue.textview_error.hide()
> - dialogue.connect(dialogue.button_bugreport, SIGNAL("clicked()"), self.parent.reportBug)
> + # Make sure we have a suitable size depending on whether or not the view is shown
> + dialogue.adjustSize()
> dialogue.exec_()
>
> def conffile(self, current, new):
> @@ -316,7 +334,7 @@
> self.confDialogue.textview_conffile.hide()
> #FIXME, below to be tested
> #self.confDialogue.resize(self.confDialogue.minimumSizeHint())
> - self.confDialogue.connect(self.confDialogue.show_difference_button, SIGNAL("clicked()"), self.showConffile)
> + self.confDialogue.show_difference_button.clicked.connect(self.showConffile))
>
> # workaround silly dpkg
> if not os.path.exists(current):
> @@ -475,18 +493,23 @@
> except Exception as e:
> logging.warning("Error setting locales (%s)" % e)
>
> - #about = KAboutData("adept_manager","Upgrader","0.1","Dist Upgrade Tool for Kubuntu",KAboutData.License_GPL,"(c) 2007 Canonical Ltd",
> - #"http://wiki.kubuntu.org/KubuntuUpdateManager", "jriddell at ubuntu.com")
> - #about.addAuthor("Jonathan Riddell", None,"jriddell at ubuntu.com")
> - #about.addAuthor("Michael Vogt", None,"michael.vogt at ubuntu.com")
> - #KCmdLineArgs.init(["./dist-upgrade.py"],about)
> -
> # we test for DISPLAY here, QApplication does not throw a
> # exception when run without DISPLAY but dies instead
> if not "DISPLAY" in os.environ:
> raise Exception("No DISPLAY in os.environ found")
> self.app = QApplication(["ubuntu-release-upgrader"])
>
> + # Try to load default Qt translations so we don't have to worry about
> + # QStandardButton translations.
> + translator = QTranslator(self.app)
> + if PYQT_VERSION >= 0x50000:
> + translator.load(QLocale.system(), 'qt', '_', '/usr/share/qt5/translations')
> + else:
> + translator.load(QLocale.system(), 'qt', '_', '/usr/share/qt4/translations')
> + self.app.installTranslator(translator)
> +
> + QUrlOpener().setupUrlHandles()
> +
> if os.path.exists("/usr/share/icons/oxygen/48x48/apps/system-software-update.png"):
> messageIcon = QPixmap("/usr/share/icons/oxygen/48x48/apps/system-software-update.png")
> else:
> @@ -509,30 +532,7 @@
> sys.excepthook = self._handleException
>
> self.window_main.showTerminalButton.setEnabled(False)
> - self.app.connect(self.window_main.showTerminalButton, SIGNAL("clicked()"), self.showTerminal)
> -
> - #kdesu requires us to copy the xauthority file before it removes it when Adept is killed
> - fd, copyXauth = tempfile.mkstemp("", "adept")
> - if 'XAUTHORITY' in os.environ and os.environ['XAUTHORITY'] != copyXauth:
> - shutil.copy(os.environ['XAUTHORITY'], copyXauth)
> - os.environ["XAUTHORITY"] = copyXauth
> -
> - # Note that with kdesudo this needs --nonewdcop
> - ## create a new DCOP-Client:
> - #client = DCOPClient()
> - ## connect the client to the local DCOP-server:
> - #client.attach()
> -
> - #for qcstring_app in client.registeredApplications():
> - # app = str(qcstring_app)
> - # if app.startswith("adept"):
> - # adept = DCOPApp(qcstring_app, client)
> - # adeptInterface = adept.object("MainApplication-Interface")
> - # adeptInterface.quit()
> -
> - # This works just as well
> - subprocess.call(["killall", "adept_manager"])
> - subprocess.call(["killall", "adept_updater"])
> + self.window_main.showTerminalButton.clicked.connect(self.showTerminal)
>
> # init gettext
> gettext.bindtextdomain("ubuntu-release-upgrader",localedir)
> @@ -605,24 +605,12 @@
> dialog = QDialog(self.window_main)
> loadUi("dialog_error.ui", dialog)
> self.translate_widget_children(self.dialog)
> - #FIXME make URL work
> - #dialog.connect(dialog.beastie_url, SIGNAL("leftClickedURL(const QString&)"), self.openURL)
> dialog.crash_detail.setText(tbtext)
> + # Make sure we have a suitable size depending on whether or not the view is shown
> + dialogue.adjustSize()
> dialog.exec_()
> sys.exit(1)
>
> - def openURL(self, url):
> - """start konqueror"""
> - #need to run this else kdesu can't run Konqueror
> - #subprocess.call(['su', 'ubuntu', 'xhost', '+localhost'])
> - QDesktopServices.openUrl(QUrl(url))
> -
> - def reportBug(self):
> - """start konqueror"""
> - #need to run this else kdesu can't run Konqueror
> - #subprocess.call(['su', 'ubuntu', 'xhost', '+localhost'])
> - QDesktopServices.openUrl(QUrl("https://launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+filebug"))
> -
> def showTerminal(self):
> if self.window_main.konsole_frame.isVisible():
> self.window_main.konsole_frame.hide()
> @@ -708,7 +696,6 @@
> dialogue.textview_error.show()
> else:
> dialogue.textview_error.hide()
> - dialogue.button_bugreport.hide()
> dialogue.setWindowTitle(_("Information"))
>
> if os.path.exists("/usr/share/icons/oxygen/48x48/status/dialog-information.png"):
> @@ -718,6 +705,8 @@
> else:
> messageIcon = QPixmap("/usr/share/icons/crystalsvg/32x32/actions/messagebox_info.png")
> dialogue.image.setPixmap(messageIcon)
> + # Make sure we have a suitable size depending on whether or not the view is shown
> + dialogue.adjustSize()
> dialogue.exec_()
>
> def error(self, summary, msg, extended_msg=None):
> @@ -732,8 +721,6 @@
> dialogue.textview_error.show()
> else:
> dialogue.textview_error.hide()
> - dialogue.button_close.show()
> - self.app.connect(dialogue.button_bugreport, SIGNAL("clicked()"), self.reportBug)
>
> if os.path.exists("/usr/share/icons/oxygen/48x48/status/dialog-error.png"):
> messageIcon = QPixmap("/usr/share/icons/oxygen/48x48/status/dialog-error.png")
> @@ -742,6 +729,8 @@
> else:
> messageIcon = QPixmap("/usr/share/icons/crystalsvg/32x32/actions/messagebox_critical.png")
> dialogue.image.setPixmap(messageIcon)
> + # Make sure we have a suitable size depending on whether or not the view is shown
> + dialogue.adjustSize()
> dialogue.exec_()
>
> return False
> @@ -757,9 +746,11 @@
> loadUi("dialog_changes.ui", self.changesDialogue)
>
> self.changesDialogue.treeview_details.hide()
> - self.changesDialogue.connect(self.changesDialogue.show_details_button, SIGNAL("clicked()"), self.showChangesDialogueDetails)
> + self.changesDialogue.buttonBox.helpRequested.connect(self.showChangesDialogueDetails)
> self.translate_widget_children(self.changesDialogue)
> - self.changesDialogue.show_details_button.setText(_("Details") + " >>>")
> + self.changesDialogue.buttonBox.button(QDialogButtonBox.Ok).setText(_("&Start Upgrade"))
> + self.changesDialogue.buttonBox.button(QDialogButtonBox.Help).setIcon(QIcon())
> + self.changesDialogue.buttonBox.button(QDialogButtonBox.Help).setText(_("Details") + " >>>")
> self.changesDialogue.resize(self.changesDialogue.sizeHint())
>
> if os.path.exists("/usr/share/icons/oxygen/48x48/status/dialog-warning.png"):
> @@ -773,9 +764,9 @@
>
> if actions != None:
> cancel = actions[0].replace("_", "")
> - self.changesDialogue.button_cancel_changes.setText(cancel)
> + self.changesDialogue.buttonBox.button(QDialogButtonBox.Cancel).setText(cancel)
> confirm = actions[1].replace("_", "")
> - self.changesDialogue.button_confirm_changes.setText(confirm)
> + self.changesDialogue.buttonBox.button(QDialogButtonBox.Ok).setText(confirm)
>
> summaryText = "<big><b>%s</b></big>" % summary
> self.changesDialogue.label_summary.setText(summaryText)
> @@ -804,10 +795,12 @@
> def showChangesDialogueDetails(self):
> if self.changesDialogue.treeview_details.isVisible():
> self.changesDialogue.treeview_details.hide()
> - self.changesDialogue.show_details_button.setText(_("Details") + " >>>")
> + self.changesDialogue.buttonBox.button(QDialogButtonBox.Help).setText(_("Details") + " >>>")
> + # Make sure we shrink the dialog otherwise it looks silly
> + self.changesDialogue.adjustSize()
> else:
> self.changesDialogue.treeview_details.show()
> - self.changesDialogue.show_details_button.setText("<<< " + _("Details"))
> + self.changesDialogue.buttonBox.button(QDialogButtonBox.Help).setText("<<< " + _("Details"))
> self.changesDialogue.resize(self.changesDialogue.sizeHint())
>
> def askYesNoQuestion(self, summary, msg, default='No'):
>
> === added file 'DistUpgrade/QUrlOpener.py'
> --- DistUpgrade/QUrlOpener.py 1970-01-01 00:00:00 +0000
> +++ DistUpgrade/QUrlOpener.py 2014-08-05 13:50:46 +0000
> @@ -0,0 +1,80 @@
> +# QUrlOpener.py
> +# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
> +#
> +# Copyright (c) 2014 Harald Sitter <apachelogger at kubuntu.org>
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation; either version 2 of the
> +# License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program. If not, see <http://www.gnu.org/licenses/>.
> +
> +try:
> + # 14.04 has a broken pyqt5, so don't even try to import it and require
> + # pyqt4.
> + # In 14.04 various signals in pyqt5 can not be connected because it thinks
> + # the signal does not exist or has an incompatible signature. Since this
> + # potentially renders the GUI entirely broken and pyqt5 was not actively
> + # used back then it is fair to simply require qt4 on trusty systems.
> + from .utils import get_dist
> + if get_dist() == 'trusty':
> + raise ImportError
> +
> + from PyQt5.QtCore import *
> + from PyQt5.QtGui import *
> +except ImportError:
> + from PyQt4.QtCore import *
> + from PyQt4.QtGui import *
> +
> +import os
> +import subprocess
> +
> +def singleton(class_):
> + instances = {}
> + def instance(*args, **kwargs):
> + if class_ not in instances:
> + instances[class_] = class_(*args, **kwargs)
> + return instances[class_]
> + return instance
> +
> + at singleton
> +class QUrlOpener(QObject):
> + def __init__(self):
> + QObject.__init__(self)
> + self.setParent(QCoreApplication.instance())
> +
> + def setupUrlHandles(self):
> + # Make sure we don't run a root browser.
> + # NOTE: Qt native API can set an openUrl handler from a QObject
> + # function, pyqt in theory also allows an arbitrary callable. Latter has
> + # been observed to be non-functional so rely on the native handling.
> + QDesktopServices.setUrlHandler('http', self, 'openUrl')
> + QDesktopServices.setUrlHandler('https', self, 'openUrl')
> +
> + # NOTE: largely code copy from ReleaseNotesViewer which imports GTK.
> + @pyqtSlot(QUrl)
> + def openUrl(self, url):
> + url = url.toString()
> + """Open the specified URL in a browser"""
> + # Find an appropiate browser
> + if os.path.exists("/usr/bin/xdg-open"):
> + command = ["xdg-open", url]
> + elif os.path.exists("/usr/bin/kde-open"):
> + command = ["kde-open", url]
> + elif os.path.exists("/usr/bin/exo-open"):
> + command = ["exo-open", url]
> + elif os.path.exists('/usr/bin/gnome-open'):
> + command = ['gnome-open', url]
> + else:
> + command = ['x-www-browser', url]
> + # Avoid to run the browser as user root
> + if os.getuid() == 0 and 'SUDO_USER' in os.environ:
> + command = ['sudo', '-u', os.environ['SUDO_USER']] + command
> + subprocess.Popen(command)
>
> === modified file 'DistUpgrade/dialog_changes.ui'
> --- DistUpgrade/dialog_changes.ui 2008-09-12 12:19:10 +0000
> +++ DistUpgrade/dialog_changes.ui 2014-08-05 13:50:46 +0000
> @@ -1,7 +1,8 @@
> -<ui version="4.0" >
> +<?xml version="1.0" encoding="UTF-8"?>
> +<ui version="4.0">
> <class>dialog_changes</class>
> - <widget class="QDialog" name="dialog_changes" >
> - <property name="geometry" >
> + <widget class="QDialog" name="dialog_changes">
> + <property name="geometry">
> <rect>
> <x>0</x>
> <y>0</y>
> @@ -9,58 +10,51 @@
> <height>417</height>
> </rect>
> </property>
> - <property name="sizePolicy" >
> - <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
> + <property name="sizePolicy">
> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
> <horstretch>0</horstretch>
> <verstretch>0</verstretch>
> </sizepolicy>
> </property>
> - <property name="windowTitle" >
> + <property name="windowTitle">
> <string>Package Changes</string>
> </property>
> - <property name="modal" >
> + <property name="modal">
> <bool>true</bool>
> </property>
> - <layout class="QGridLayout" >
> - <item row="3" column="3" >
> - <widget class="QPushButton" name="button_cancel_changes" >
> - <property name="text" >
> - <string>&Cancel</string>
> - </property>
> - </widget>
> - </item>
> - <item row="0" column="0" colspan="4" >
> - <layout class="QHBoxLayout" >
> + <layout class="QVBoxLayout" name="verticalLayout">
> + <item>
> + <layout class="QHBoxLayout">
> <item>
> - <layout class="QVBoxLayout" >
> + <layout class="QVBoxLayout">
> <item>
> - <widget class="QLabel" name="question_pixmap" >
> - <property name="sizePolicy" >
> - <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
> + <widget class="QLabel" name="question_pixmap">
> + <property name="sizePolicy">
> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
> <horstretch>0</horstretch>
> <verstretch>0</verstretch>
> </sizepolicy>
> </property>
> - <property name="text" >
> + <property name="text">
> <string/>
> </property>
> - <property name="pixmap" >
> + <property name="pixmap">
> <pixmap>image0</pixmap>
> </property>
> - <property name="wordWrap" >
> + <property name="wordWrap">
> <bool>false</bool>
> </property>
> </widget>
> </item>
> <item>
> - <spacer name="spacer6" >
> - <property name="orientation" >
> + <spacer name="spacer6">
> + <property name="orientation">
> <enum>Qt::Vertical</enum>
> </property>
> - <property name="sizeType" >
> + <property name="sizeType">
> <enum>QSizePolicy::Expanding</enum>
> </property>
> - <property name="sizeHint" stdset="0" >
> + <property name="sizeHint" stdset="0">
> <size>
> <width>20</width>
> <height>80</height>
> @@ -71,141 +65,121 @@
> </layout>
> </item>
> <item>
> - <layout class="QVBoxLayout" >
> - <item>
> - <widget class="QLabel" name="label_summary" >
> - <property name="text" >
> - <string/>
> - </property>
> - <property name="textFormat" >
> - <enum>Qt::RichText</enum>
> - </property>
> - <property name="alignment" >
> - <set>Qt::AlignVCenter</set>
> - </property>
> - <property name="wordWrap" >
> - <bool>true</bool>
> - </property>
> - </widget>
> - </item>
> - <item>
> - <widget class="QLabel" name="label_changes" >
> - <property name="sizePolicy" >
> - <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
> - <horstretch>0</horstretch>
> - <verstretch>0</verstretch>
> - </sizepolicy>
> - </property>
> - <property name="text" >
> - <string/>
> - </property>
> - <property name="textFormat" >
> - <enum>Qt::RichText</enum>
> - </property>
> - <property name="alignment" >
> - <set>Qt::AlignVCenter</set>
> - </property>
> - <property name="wordWrap" >
> - <bool>true</bool>
> - </property>
> - </widget>
> + <layout class="QVBoxLayout">
> + <item>
> + <widget class="QLabel" name="label_summary">
> + <property name="sizePolicy">
> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
> + <horstretch>0</horstretch>
> + <verstretch>0</verstretch>
> + </sizepolicy>
> + </property>
> + <property name="text">
> + <string/>
> + </property>
> + <property name="textFormat">
> + <enum>Qt::RichText</enum>
> + </property>
> + <property name="alignment">
> + <set>Qt::AlignVCenter</set>
> + </property>
> + <property name="wordWrap">
> + <bool>true</bool>
> + </property>
> + </widget>
> + </item>
> + <item>
> + <widget class="QLabel" name="label_changes">
> + <property name="sizePolicy">
> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
> + <horstretch>0</horstretch>
> + <verstretch>0</verstretch>
> + </sizepolicy>
> + </property>
> + <property name="text">
> + <string/>
> + </property>
> + <property name="textFormat">
> + <enum>Qt::RichText</enum>
> + </property>
> + <property name="alignment">
> + <set>Qt::AlignVCenter</set>
> + </property>
> + <property name="wordWrap">
> + <bool>true</bool>
> + </property>
> + </widget>
> + </item>
> + <item>
> + <spacer name="spacer6_2">
> + <property name="orientation">
> + <enum>Qt::Vertical</enum>
> + </property>
> + <property name="sizeHint" stdset="0">
> + <size>
> + <width>0</width>
> + <height>0</height>
> + </size>
> + </property>
> + </spacer>
> </item>
> </layout>
> </item>
> </layout>
> </item>
> - <item row="1" column="0" >
> - <widget class="QPushButton" name="show_details_button" >
> - <property name="text" >
> - <string>Details >>></string>
> - </property>
> - </widget>
> - </item>
> - <item row="1" column="1" colspan="3" >
> - <spacer name="spacer2" >
> - <property name="orientation" >
> - <enum>Qt::Horizontal</enum>
> - </property>
> - <property name="sizeType" >
> - <enum>QSizePolicy::Expanding</enum>
> - </property>
> - <property name="sizeHint" stdset="0" >
> - <size>
> - <width>341</width>
> - <height>21</height>
> - </size>
> - </property>
> - </spacer>
> - </item>
> - <item row="3" column="2" >
> - <widget class="QPushButton" name="button_confirm_changes" >
> - <property name="text" >
> - <string>_Start Upgrade</string>
> - </property>
> - </widget>
> - </item>
> - <item row="3" column="0" colspan="2" >
> - <spacer name="spacer3" >
> - <property name="orientation" >
> - <enum>Qt::Horizontal</enum>
> - </property>
> - <property name="sizeType" >
> - <enum>QSizePolicy::Expanding</enum>
> - </property>
> - <property name="sizeHint" stdset="0" >
> - <size>
> - <width>161</width>
> - <height>20</height>
> - </size>
> - </property>
> - </spacer>
> - </item>
> - <item row="2" column="0" colspan="4" >
> - <widget class="QTreeWidget" name="treeview_details" >
> - <property name="rootIsDecorated" >
> + <item>
> + <widget class="QTreeWidget" name="treeview_details">
> + <property name="rootIsDecorated">
> <bool>false</bool>
> </property>
> <column>
> - <property name="text" >
> + <property name="text">
> <string>1</string>
> </property>
> </column>
> </widget>
> </item>
> + <item>
> + <widget class="QDialogButtonBox" name="buttonBox">
> + <property name="standardButtons">
> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
> + </property>
> + </widget>
> + </item>
> </layout>
> </widget>
> - <layoutdefault spacing="6" margin="11" />
> + <layoutdefault spacing="6" margin="11"/>
> <resources/>
> <connections>
> <connection>
> - <sender>button_confirm_changes</sender>
> - <signal>clicked()</signal>
> + <sender>buttonBox</sender>
> + <signal>accepted()</signal>
> <receiver>dialog_changes</receiver>
> <slot>accept()</slot>
> <hints>
> - <hint type="sourcelabel" >
> - <x>20</x>
> - <y>20</y>
> + <hint type="sourcelabel">
> + <x>293</x>
> + <y>163</y>
> </hint>
> - <hint type="destinationlabel" >
> - <x>20</x>
> - <y>20</y>
> + <hint type="destinationlabel">
> + <x>293</x>
> + <y>208</y>
> </hint>
> </hints>
> </connection>
> <connection>
> - <sender>button_cancel_changes</sender>
> - <signal>clicked()</signal>
> + <sender>buttonBox</sender>
> + <signal>rejected()</signal>
> <receiver>dialog_changes</receiver>
> <slot>reject()</slot>
> <hints>
> - <hint type="sourcelabel" >
> - <x>20</x>
> - <y>20</y>
> + <hint type="sourcelabel">
> + <x>293</x>
> + <y>163</y>
> </hint>
> - <hint type="destinationlabel" >
> - <x>20</x>
> - <y>20</y>
> + <hint type="destinationlabel">
> + <x>293</x>
> + <y>208</y>
> </hint>
> </hints>
> </connection>
>
> === modified file 'DistUpgrade/dialog_error.ui'
> --- DistUpgrade/dialog_error.ui 2008-09-12 12:19:10 +0000
> +++ DistUpgrade/dialog_error.ui 2014-08-05 13:50:46 +0000
> @@ -1,117 +1,99 @@
> -<ui version="4.0" >
> +<?xml version="1.0" encoding="UTF-8"?>
> +<ui version="4.0">
> <class>dialog_error</class>
> - <widget class="QDialog" name="dialog_error" >
> - <property name="geometry" >
> + <widget class="QDialog" name="dialog_error">
> + <property name="geometry">
> <rect>
> <x>0</x>
> <y>0</y>
> - <width>427</width>
> - <height>343</height>
> + <width>268</width>
> + <height>263</height>
> </rect>
> </property>
> - <property name="windowTitle" >
> + <property name="sizePolicy">
> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
> + <horstretch>0</horstretch>
> + <verstretch>0</verstretch>
> + </sizepolicy>
> + </property>
> + <property name="windowTitle">
> <string>Error</string>
> </property>
> - <property name="modal" >
> + <property name="modal">
> <bool>true</bool>
> </property>
> - <layout class="QGridLayout" >
> - <item row="1" column="0" >
> - <spacer name="spacer4" >
> - <property name="orientation" >
> - <enum>Qt::Vertical</enum>
> - </property>
> - <property name="sizeType" >
> - <enum>QSizePolicy::Expanding</enum>
> - </property>
> - <property name="sizeHint" stdset="0" >
> - <size>
> - <width>21</width>
> - <height>161</height>
> - </size>
> - </property>
> - </spacer>
> - </item>
> - <item row="3" column="3" >
> - <widget class="QPushButton" name="button_close" >
> - <property name="text" >
> - <string>&Close</string>
> - </property>
> - </widget>
> - </item>
> - <item row="0" column="0" >
> - <widget class="QLabel" name="image" >
> - <property name="sizePolicy" >
> - <sizepolicy vsizetype="Preferred" hsizetype="Fixed" >
> - <horstretch>0</horstretch>
> - <verstretch>0</verstretch>
> - </sizepolicy>
> - </property>
> - <property name="text" >
> - <string/>
> - </property>
> - <property name="pixmap" >
> - <pixmap>image0</pixmap>
> - </property>
> - <property name="wordWrap" >
> - <bool>false</bool>
> - </property>
> - </widget>
> - </item>
> - <item row="0" column="1" colspan="3" >
> - <widget class="QLabel" name="label_error" >
> - <property name="text" >
> - <string/>
> - </property>
> - <property name="wordWrap" >
> + <layout class="QVBoxLayout" name="verticalLayout">
> + <item>
> + <layout class="QHBoxLayout" name="horizontalLayout">
> + <item>
> + <widget class="QLabel" name="image">
> + <property name="sizePolicy">
> + <sizepolicy hsizetype="Fixed" vsizetype="Minimum">
> + <horstretch>0</horstretch>
> + <verstretch>0</verstretch>
> + </sizepolicy>
> + </property>
> + <property name="text">
> + <string/>
> + </property>
> + <property name="pixmap">
> + <pixmap>image0</pixmap>
> + </property>
> + <property name="wordWrap">
> + <bool>false</bool>
> + </property>
> + </widget>
> + </item>
> + <item>
> + <widget class="QLabel" name="label_error">
> + <property name="sizePolicy">
> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
> + <horstretch>0</horstretch>
> + <verstretch>0</verstretch>
> + </sizepolicy>
> + </property>
> + <property name="text">
> + <string/>
> + </property>
> + <property name="wordWrap">
> + <bool>true</bool>
> + </property>
> + </widget>
> + </item>
> + </layout>
> + </item>
> + <item>
> + <widget class="QTextBrowser" name="textview_error">
> + <property name="openExternalLinks">
> <bool>true</bool>
> </property>
> </widget>
> </item>
> - <item row="3" column="0" colspan="2" >
> - <spacer name="spacer5" >
> - <property name="orientation" >
> - <enum>Qt::Horizontal</enum>
> - </property>
> - <property name="sizeType" >
> - <enum>QSizePolicy::Expanding</enum>
> - </property>
> - <property name="sizeHint" stdset="0" >
> - <size>
> - <width>130</width>
> - <height>21</height>
> - </size>
> - </property>
> - </spacer>
> - </item>
> - <item row="3" column="2" >
> - <widget class="QPushButton" name="button_bugreport" >
> - <property name="text" >
> - <string>_Report Bug</string>
> + <item>
> + <widget class="QDialogButtonBox" name="buttonBox">
> + <property name="standardButtons">
> + <set>QDialogButtonBox::Close</set>
> </property>
> </widget>
> </item>
> - <item rowspan="2" row="1" column="1" colspan="3" >
> - <widget class="QTextEdit" name="textview_error" />
> - </item>
> </layout>
> </widget>
> - <layoutdefault spacing="6" margin="11" />
> + <layoutdefault spacing="6" margin="11"/>
> <resources/>
> <connections>
> <connection>
> - <sender>button_close</sender>
> - <signal>clicked()</signal>
> + <sender>buttonBox</sender>
> + <signal>rejected()</signal>
> <receiver>dialog_error</receiver>
> <slot>close()</slot>
> <hints>
> - <hint type="sourcelabel" >
> - <x>20</x>
> - <y>20</y>
> + <hint type="sourcelabel">
> + <x>182</x>
> + <y>274</y>
> </hint>
> - <hint type="destinationlabel" >
> - <x>20</x>
> - <y>20</y>
> + <hint type="destinationlabel">
> + <x>182</x>
> + <y>147</y>
> </hint>
> </hints>
> </connection>
>
> === modified file 'DistUpgrade/dialog_release_notes.ui'
> --- DistUpgrade/dialog_release_notes.ui 2012-06-28 16:12:09 +0000
> +++ DistUpgrade/dialog_release_notes.ui 2014-08-05 13:50:46 +0000
> @@ -1,7 +1,8 @@
> -<ui version="4.0" >
> +<?xml version="1.0" encoding="UTF-8"?>
> +<ui version="4.0">
> <class>Dialog</class>
> - <widget class="QDialog" name="Dialog" >
> - <property name="geometry" >
> + <widget class="QDialog" name="Dialog">
> + <property name="geometry">
> <rect>
> <x>0</x>
> <y>0</y>
> @@ -9,27 +10,30 @@
> <height>476</height>
> </rect>
> </property>
> - <property name="windowTitle" >
> + <property name="windowTitle">
> <string>Dialog</string>
> </property>
> - <layout class="QGridLayout" name="gridLayout" >
> - <item row="0" column="0" >
> - <widget class="QTextEdit" name="scrolled_notes" >
> - <property name="readOnly" >
> - <bool>true</bool>
> - </property>
> - </widget>
> - </item>
> - <item row="1" column="0" >
> - <widget class="QDialogButtonBox" name="buttonBox" >
> - <property name="orientation" >
> + <layout class="QGridLayout" name="gridLayout">
> + <item row="1" column="0">
> + <widget class="QDialogButtonBox" name="buttonBox">
> + <property name="orientation">
> <enum>Qt::Horizontal</enum>
> </property>
> - <property name="standardButtons" >
> + <property name="standardButtons">
> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
> </property>
> </widget>
> </item>
> + <item row="0" column="0">
> + <widget class="QTextBrowser" name="scrolled_notes">
> + <property name="readOnly">
> + <bool>true</bool>
> + </property>
> + <property name="openExternalLinks">
> + <bool>true</bool>
> + </property>
> + </widget>
> + </item>
> </layout>
> </widget>
> <resources/>
> @@ -40,11 +44,11 @@
> <receiver>Dialog</receiver>
> <slot>accept()</slot>
> <hints>
> - <hint type="sourcelabel" >
> + <hint type="sourcelabel">
> <x>248</x>
> <y>254</y>
> </hint>
> - <hint type="destinationlabel" >
> + <hint type="destinationlabel">
> <x>157</x>
> <y>274</y>
> </hint>
> @@ -56,11 +60,11 @@
> <receiver>Dialog</receiver>
> <slot>reject()</slot>
> <hints>
> - <hint type="sourcelabel" >
> + <hint type="sourcelabel">
> <x>316</x>
> <y>260</y>
> </hint>
> - <hint type="destinationlabel" >
> + <hint type="destinationlabel">
> <x>286</x>
> <y>274</y>
> </hint>
>
> === modified file 'DistUpgrade/fetch-progress.ui'
> --- DistUpgrade/fetch-progress.ui 2012-06-28 16:12:09 +0000
> +++ DistUpgrade/fetch-progress.ui 2014-08-05 13:50:46 +0000
> @@ -1,67 +1,36 @@
> -<ui version="4.0" >
> +<?xml version="1.0" encoding="UTF-8"?>
> +<ui version="4.0">
> <class>Dialog</class>
> - <widget class="QDialog" name="Dialog" >
> - <property name="geometry" >
> + <widget class="QDialog" name="Dialog">
> + <property name="geometry">
> <rect>
> <x>0</x>
> <y>0</y>
> - <width>408</width>
> - <height>129</height>
> + <width>409</width>
> + <height>93</height>
> </rect>
> </property>
> - <property name="windowTitle" >
> + <property name="windowTitle">
> <string>Dialog</string>
> </property>
> - <layout class="QGridLayout" name="gridLayout_3" >
> - <item row="4" column="0" >
> - <widget class="QWidget" native="1" name="installFrame" >
> - <layout class="QGridLayout" name="gridLayout_2" >
> - <property name="margin" >
> - <number>0</number>
> - </property>
> - <item row="1" column="0" colspan="2" >
> - <widget class="QProgressBar" name="installationProgress" >
> - <property name="value" >
> - <number>24</number>
> - </property>
> - </widget>
> - </item>
> - <item row="3" column="0" colspan="2" >
> - <widget class="QWidget" native="1" name="konsoleFrame" />
> - </item>
> - <item row="4" column="0" colspan="2" >
> - <spacer name="verticalSpacer" >
> - <property name="orientation" >
> - <enum>Qt::Vertical</enum>
> - </property>
> - <property name="sizeHint" stdset="0" >
> - <size>
> - <width>397</width>
> - <height>5</height>
> - </size>
> - </property>
> - </spacer>
> - </item>
> - <item row="0" column="0" colspan="2" >
> - <widget class="QLabel" name="installingLabel" >
> - <property name="text" >
> - <string/>
> - </property>
> - </widget>
> - </item>
> - </layout>
> - </widget>
> - </item>
> - <item row="0" column="0" >
> - <widget class="QLabel" name="titleLabel" >
> - <property name="text" >
> + <layout class="QVBoxLayout" name="verticalLayout">
> + <item>
> + <widget class="QLabel" name="installingLabel">
> + <property name="text">
> <string/>
> </property>
> </widget>
> </item>
> - <item row="5" column="0" >
> - <widget class="QDialogButtonBox" name="buttonBox" >
> - <property name="standardButtons" >
> + <item>
> + <widget class="QProgressBar" name="installationProgress">
> + <property name="value">
> + <number>24</number>
> + </property>
> + </widget>
> + </item>
> + <item>
> + <widget class="QDialogButtonBox" name="buttonBox">
> + <property name="standardButtons">
> <set>QDialogButtonBox::Close</set>
> </property>
> </widget>
> @@ -76,11 +45,11 @@
> <receiver>Dialog</receiver>
> <slot>accept()</slot>
> <hints>
> - <hint type="sourcelabel" >
> + <hint type="sourcelabel">
> <x>271</x>
> <y>169</y>
> </hint>
> - <hint type="destinationlabel" >
> + <hint type="destinationlabel">
> <x>271</x>
> <y>94</y>
> </hint>
> @@ -92,11 +61,11 @@
> <receiver>Dialog</receiver>
> <slot>reject()</slot>
> <hints>
> - <hint type="sourcelabel" >
> + <hint type="sourcelabel">
> <x>271</x>
> <y>169</y>
> </hint>
> - <hint type="destinationlabel" >
> + <hint type="destinationlabel">
> <x>271</x>
> <y>94</y>
> </hint>
>
> === modified file 'DistUpgrade/window_main.ui'
> --- DistUpgrade/window_main.ui 2014-05-02 11:46:02 +0000
> +++ DistUpgrade/window_main.ui 2014-08-05 13:50:46 +0000
> @@ -1,7 +1,8 @@
> -<ui version="4.0" >
> +<?xml version="1.0" encoding="UTF-8"?>
> +<ui version="4.0">
> <class>window_main</class>
> - <widget class="QWidget" name="window_main" >
> - <property name="geometry" >
> + <widget class="QWidget" name="window_main">
> + <property name="geometry">
> <rect>
> <x>0</x>
> <y>0</y>
> @@ -9,26 +10,26 @@
> <height>294</height>
> </rect>
> </property>
> - <property name="windowTitle" >
> + <property name="windowTitle">
> <string>Distribution Upgrade</string>
> </property>
> - <layout class="QGridLayout" >
> - <item row="6" column="0" >
> - <widget class="QPushButton" name="showTerminalButton" >
> - <property name="text" >
> - <string>Show Terminal >>></string>
> + <layout class="QGridLayout">
> + <item row="6" column="0">
> + <widget class="QPushButton" name="showTerminalButton">
> + <property name="text">
> + <string>Show Terminal >>></string>
> </property>
> </widget>
> </item>
> - <item row="6" column="1" >
> - <spacer name="spacer1" >
> - <property name="orientation" >
> + <item row="6" column="1">
> + <spacer name="spacer1">
> + <property name="orientation">
> <enum>Qt::Horizontal</enum>
> </property>
> - <property name="sizeType" >
> + <property name="sizeType">
> <enum>QSizePolicy::Expanding</enum>
> </property>
> - <property name="sizeHint" stdset="0" >
> + <property name="sizeHint" stdset="0">
> <size>
> <width>302</width>
> <height>21</height>
> @@ -36,25 +37,25 @@
> </property>
> </spacer>
> </item>
> - <item rowspan="2" row="4" column="0" colspan="4" >
> - <widget class="QLabel" name="label_status" >
> - <property name="text" >
> + <item row="4" column="0" rowspan="2" colspan="4">
> + <widget class="QLabel" name="label_status">
> + <property name="text">
> <string/>
> </property>
> - <property name="wordWrap" >
> + <property name="wordWrap">
> <bool>false</bool>
> </property>
> </widget>
> </item>
> - <item rowspan="2" row="5" column="2" >
> - <spacer name="spacer3" >
> - <property name="orientation" >
> + <item row="5" column="2" rowspan="2">
> + <spacer name="spacer3">
> + <property name="orientation">
> <enum>Qt::Vertical</enum>
> </property>
> - <property name="sizeType" >
> + <property name="sizeType">
> <enum>QSizePolicy::Expanding</enum>
> </property>
> - <property name="sizeHint" stdset="0" >
> + <property name="sizeHint" stdset="0">
> <size>
> <width>20</width>
> <height>16</height>
> @@ -62,206 +63,212 @@
> </property>
> </spacer>
> </item>
> - <item row="2" column="0" colspan="4" >
> - <widget class="QLabel" name="progress_text" >
> - <property name="text" >
> + <item row="2" column="0" colspan="4">
> + <widget class="QLabel" name="progress_text">
> + <property name="text">
> <string/>
> </property>
> - <property name="wordWrap" >
> + <property name="wordWrap">
> <bool>false</bool>
> </property>
> </widget>
> </item>
> - <item row="1" column="0" colspan="4" >
> - <layout class="QGridLayout" >
> - <item row="3" column="0" >
> - <widget class="QLabel" name="image_step4" >
> - <property name="sizePolicy" >
> - <sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
> - <horstretch>0</horstretch>
> - <verstretch>0</verstretch>
> - </sizepolicy>
> - </property>
> - <property name="text" >
> - <string/>
> - </property>
> - <property name="wordWrap" >
> - <bool>false</bool>
> - </property>
> - </widget>
> - </item>
> - <item row="1" column="0" >
> - <widget class="QLabel" name="image_step2" >
> - <property name="sizePolicy" >
> - <sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
> - <horstretch>0</horstretch>
> - <verstretch>0</verstretch>
> - </sizepolicy>
> - </property>
> - <property name="text" >
> - <string/>
> - </property>
> - <property name="wordWrap" >
> - <bool>false</bool>
> - </property>
> - </widget>
> - </item>
> - <item row="0" column="1" >
> - <widget class="QLabel" name="label_step1" >
> - <property name="text" >
> + <item row="1" column="0" colspan="4">
> + <layout class="QGridLayout">
> + <item row="3" column="0">
> + <widget class="QLabel" name="image_step4">
> + <property name="sizePolicy">
> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
> + <horstretch>0</horstretch>
> + <verstretch>0</verstretch>
> + </sizepolicy>
> + </property>
> + <property name="text">
> + <string/>
> + </property>
> + <property name="wordWrap">
> + <bool>false</bool>
> + </property>
> + </widget>
> + </item>
> + <item row="1" column="0">
> + <widget class="QLabel" name="image_step2">
> + <property name="sizePolicy">
> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
> + <horstretch>0</horstretch>
> + <verstretch>0</verstretch>
> + </sizepolicy>
> + </property>
> + <property name="text">
> + <string/>
> + </property>
> + <property name="wordWrap">
> + <bool>false</bool>
> + </property>
> + </widget>
> + </item>
> + <item row="0" column="1">
> + <widget class="QLabel" name="label_step1">
> + <property name="text">
> <string>Preparing to upgrade</string>
> </property>
> - <property name="wordWrap" >
> - <bool>false</bool>
> - </property>
> - </widget>
> - </item>
> - <item row="0" column="0" >
> - <widget class="QLabel" name="image_step1" >
> - <property name="sizePolicy" >
> - <sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
> - <horstretch>0</horstretch>
> - <verstretch>0</verstretch>
> - </sizepolicy>
> - </property>
> - <property name="text" >
> - <string/>
> - </property>
> - <property name="wordWrap" >
> - <bool>false</bool>
> - </property>
> - </widget>
> - </item>
> - <item row="2" column="0" >
> - <widget class="QLabel" name="image_step3" >
> - <property name="sizePolicy" >
> - <sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
> - <horstretch>0</horstretch>
> - <verstretch>0</verstretch>
> - </sizepolicy>
> - </property>
> - <property name="text" >
> - <string/>
> - </property>
> - <property name="wordWrap" >
> - <bool>false</bool>
> - </property>
> - </widget>
> - </item>
> - <item row="2" column="1" >
> - <widget class="QLabel" name="label_step3" >
> - <property name="text" >
> + <property name="wordWrap">
> + <bool>false</bool>
> + </property>
> + </widget>
> + </item>
> + <item row="0" column="0">
> + <widget class="QLabel" name="image_step1">
> + <property name="sizePolicy">
> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
> + <horstretch>0</horstretch>
> + <verstretch>0</verstretch>
> + </sizepolicy>
> + </property>
> + <property name="text">
> + <string/>
> + </property>
> + <property name="wordWrap">
> + <bool>false</bool>
> + </property>
> + </widget>
> + </item>
> + <item row="2" column="0">
> + <widget class="QLabel" name="image_step3">
> + <property name="sizePolicy">
> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
> + <horstretch>0</horstretch>
> + <verstretch>0</verstretch>
> + </sizepolicy>
> + </property>
> + <property name="text">
> + <string/>
> + </property>
> + <property name="wordWrap">
> + <bool>false</bool>
> + </property>
> + </widget>
> + </item>
> + <item row="2" column="1">
> + <widget class="QLabel" name="label_step3">
> + <property name="text">
> <string>Getting new packages</string>
> </property>
> - <property name="wordWrap" >
> + <property name="wordWrap">
> <bool>false</bool>
> </property>
> </widget>
> </item>
> - <item row="4" column="1" >
> - <widget class="QLabel" name="label_step5" >
> - <property name="text" >
> + <item row="4" column="1">
> + <widget class="QLabel" name="label_step5">
> + <property name="text">
> <string>Cleaning up</string>
> </property>
> - <property name="wordWrap" >
> + <property name="wordWrap">
> <bool>false</bool>
> </property>
> </widget>
> </item>
> - <item row="3" column="1" >
> - <widget class="QLabel" name="label_step4" >
> - <property name="text" >
> + <item row="3" column="1">
> + <widget class="QLabel" name="label_step4">
> + <property name="text">
> <string>Installing the upgrades</string>
> </property>
> - <property name="wordWrap" >
> + <property name="wordWrap">
> <bool>false</bool>
> </property>
> </widget>
> </item>
> - <item row="1" column="1" >
> - <widget class="QLabel" name="label_step2" >
> - <property name="text" >
> + <item row="1" column="1">
> + <widget class="QLabel" name="label_step2">
> + <property name="text">
> <string>Setting new software channels</string>
> </property>
> - <property name="wordWrap" >
> + <property name="wordWrap">
> <bool>false</bool>
> </property>
> </widget>
> </item>
> - <item row="5" column="1" >
> - <widget class="QLabel" name="label_step6" >
> - <property name="text" >
> + <item row="5" column="1">
> + <widget class="QLabel" name="label_step6">
> + <property name="text">
> <string>Restarting the computer</string>
> </property>
> - <property name="wordWrap" >
> - <bool>false</bool>
> - </property>
> - </widget>
> - </item>
> - <item row="4" column="0" >
> - <widget class="QLabel" name="image_step5" >
> - <property name="sizePolicy" >
> - <sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
> - <horstretch>0</horstretch>
> - <verstretch>0</verstretch>
> - </sizepolicy>
> - </property>
> - <property name="text" >
> - <string/>
> - </property>
> - <property name="wordWrap" >
> - <bool>false</bool>
> - </property>
> - </widget>
> - </item>
> - <item row="5" column="0" >
> - <widget class="QLabel" name="image_step6" >
> - <property name="sizePolicy" >
> - <sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
> - <horstretch>0</horstretch>
> - <verstretch>0</verstretch>
> - </sizepolicy>
> - </property>
> - <property name="text" >
> - <string/>
> - </property>
> - <property name="wordWrap" >
> + <property name="wordWrap">
> + <bool>false</bool>
> + </property>
> + </widget>
> + </item>
> + <item row="4" column="0">
> + <widget class="QLabel" name="image_step5">
> + <property name="sizePolicy">
> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
> + <horstretch>0</horstretch>
> + <verstretch>0</verstretch>
> + </sizepolicy>
> + </property>
> + <property name="text">
> + <string/>
> + </property>
> + <property name="wordWrap">
> + <bool>false</bool>
> + </property>
> + </widget>
> + </item>
> + <item row="5" column="0">
> + <widget class="QLabel" name="image_step6">
> + <property name="sizePolicy">
> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
> + <horstretch>0</horstretch>
> + <verstretch>0</verstretch>
> + </sizepolicy>
> + </property>
> + <property name="text">
> + <string/>
> + </property>
> + <property name="wordWrap">
> <bool>false</bool>
> </property>
> </widget>
> </item>
> </layout>
> </item>
> - <item row="0" column="0" colspan="4" >
> - <widget class="QLabel" name="label_title" >
> - <property name="text" >
> - <string><b><big>Upgrading Ubuntu to version 14.10</big></b></string>
> + <item row="0" column="0" colspan="4">
> + <widget class="QLabel" name="label_title">
> + <property name="text">
> + <string><b><big>Upgrading Ubuntu to version 14.10</big></b></string>
> </property>
> - <property name="wordWrap" >
> + <property name="wordWrap">
> <bool>false</bool>
> </property>
> </widget>
> </item>
> - <item row="7" column="0" colspan="3" >
> - <widget class="QFrame" name="konsole_frame" >
> - <property name="frameShape" >
> + <item row="7" column="0" colspan="3">
> + <widget class="QFrame" name="konsole_frame">
> + <property name="frameShape">
> <enum>QFrame::StyledPanel</enum>
> </property>
> - <property name="frameShadow" >
> + <property name="frameShadow">
> <enum>QFrame::Raised</enum>
> </property>
> </widget>
> </item>
> - <item row="3" column="0" colspan="3" >
> - <widget class="QProgressBar" name="progressbar_cache" >
> - <property name="value" >
> + <item row="3" column="0" colspan="3">
> + <widget class="QProgressBar" name="progressbar_cache">
> + <property name="sizePolicy">
> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
> + <horstretch>0</horstretch>
> + <verstretch>0</verstretch>
> + </sizepolicy>
> + </property>
> + <property name="value">
> <number>24</number>
> </property>
> </widget>
> </item>
> </layout>
> </widget>
> - <layoutdefault spacing="6" margin="11" />
> + <layoutdefault spacing="6" margin="11"/>
> <resources/>
> <connections/>
> </ui>
>
> === modified file 'debian/changelog'
> --- debian/changelog 2014-08-05 06:33:47 +0000
> +++ debian/changelog 2014-08-05 13:50:46 +0000
> @@ -1,9 +1,96 @@
> +<<<<<<< TREE
This looks wrong, please fix
> ubuntu-release-upgrader (1:14.10.6) UNRELEASED; urgency=medium
>
> * check-new-release-gtk: Fix deprecated Gio.Settings constructor invocation.
>
> -- Martin Pitt <martin.pitt at ubuntu.com> Tue, 05 Aug 2014 08:33:11 +0200
>
> +=======
> +ubuntu-release-upgrader (1:14.10.6ubuntu1) UNRELEASED; urgency=medium
> +
> + * Port KDE GUIs to native Qt5 versions.
> + + pyqt5 is only imported iff the current dist version is not trusty as
> + that one had a nasty bug with signals and slots not connecting properly.
> + + pyqt4/pykde4 compatibility is retained by fallback handling for the
> + pyqt5 import, as well as some version checks switching out kde classes
> + for qt classes when using Qt5. Ultimately systems <=utopic will retain
> + the same behavior as before.
> + + KDE bits replacemed as follows:
> + * KIcon -> QIcon::fromTheme
> + * KMessageBox -> QMessageBox (using most suitable version from the
> + limited feature set of QMB)
> + * KApplication -> QApplication
> + * i18n -> _()
> + * Fix KDE upgrade fetcher GUI
> + + Wire up do-release-upgrade with the KDE GUI to actually provide a UI
> + when run from a KDE Plasma envrionment
> + + Remove all logic that replicated stuff done in do-release-upgrade
> + (this primarily includes using MetaRelease to actually conduct the
> + version check, the automatic version checks are done by a special
> + script that is part of muon, so we do not ever call the fetcher
> + manually, and have not done so in at least 5 years)
> + + Detangle the Acquire class from the Fetcher class, latter is not
> + automatically constructing former any longer but needs to get it
> + supplied from the outside (i.e. do-release-upgrade)
> + + init arguments of both classes are now alinged with their GTK
> + counterparts
> + + The designer ui file now uses a QTextBrowser rather than a QTextEdit as
> + the user doesn't need to edit anything and the former supports html and
> + url opening
> + + The fetcher ui file has had all unused widgets removed which makes the
> + fetcher dialog have correct spacing
> + + The classes now hold a QApp as self.app to reflect the fact that they
> + may be constructed in any order and thus may need a QApplication in any
> + order. The actually instance is created from a new function that creates
> + an instance if there isn't one already. Ultimately this should probably
> + become a singleton.
> + + The Acquire process can now be aborted properly.
> + * Fix translation loading. As all Qt GUIs no prominently feature Qt builtin
> + classes with strings (QMessageBox, QButtonBox) we make sure that the
> + correct translations are loaded through QTranslator right after creating
> + the QApplication instances.
> + + ubuntu-release-upgrader-qt now recommends qttranslations5-l10n to
> + reflect this on a packaging level
> + * Add a new class QUrlOpener to redirect all openUrl calls through sudo -u
> + if the GUI is run as root, so that we can start the browsers as the user
> + rather than root. This class is used in both the Fetcher and the Upgrader.
> + It is a singleton that autoparents to qapp, so a qapp instance needs to be
> + available before using the opener.
> + * Improve Upgrader GUI
> + + Upgrader GUI does not meddle with xauthority anymore and doesn't kill
> + adept anymore (mind you, adept hasn't been used in years...)
> + Also the meddling seems to have been bugged in one form or the other
> + which ultimately prevents us from doing a proper openUrl as the invoking
> + user
> + + dialog_error.ui has been converted to use QTextBrowser as there is no
> + editing need.
> + + error dialog size hinting as been adjusted to make sure the window can
> + not be resized beyond what is suitable to still display stuff.
> + + error dialog window size is adjusted before exec to make sure that
> + the window has a suitable default size depending on whether the textview
> + is displayed or not
> + + dialog_error.ui has had its close button replaced with a standard
> + QButtonBox
> + + reportBug function has been removed as it is not used anymore (core
> + brings up apport regardless and the bug report url is most inconvenient
> + and pointless because people will not attach the relevant logs...)
> + + openUrl function has been removed as it is not used anymore
> + + dialog_changes.ui has had its size hinting adjusted to make sure that
> + the window has a suitable default size
> + + dialog_changes.ui uses QDialogButtonBox for all buttons now, details is
> + derived from Help which is the closest fit as far as standard types are
> + concerned
> + + The changes dialog now adjusts its size when the details widget is
> + hidden, this prevents overly large windows after details was shown once
> + + The changes dialog now correctly spaces the labels as well as the icon
> + label at the window, this resolves text jumping when showing/hiding the
> + details widget which was caused by the labels being pushed towards the
> + top to make space for the details, now a space makes that happen all the
> + time
> +
> + -- Harald Sitter <apachelogger at kubuntu.org> Tue, 05 Aug 2014 15:20:10 +0200
> +
> +>>>>>>> MERGE-SOURCE
Merge marker, please remove
> ubuntu-release-upgrader (1:14.10.5) utopic; urgency=medium
>
> [ Brian Murray ]
>
> === modified file 'debian/control'
> --- debian/control 2014-03-13 17:06:03 +0000
> +++ debian/control 2014-08-05 13:50:46 +0000
> @@ -67,9 +67,10 @@
> Pre-Depends: ${misc:Pre-Depends}
> Depends: ${misc:Depends},
> ubuntu-release-upgrader-core (= ${source:Version}),
> - python3-pykde4,
> + python3-pyqt5,
> kdesudo,
> psmisc
> +Recommends: qttranslations5-l10n
> Replaces: update-manager-kde (<< 1:0.165)
> Breaks: update-manager-kde (<< 1:0.165)
> Description: manage release upgrades
>
> === modified file 'do-release-upgrade'
> --- do-release-upgrade 2014-03-07 17:00:00 +0000
> +++ do-release-upgrade 2014-08-05 13:50:46 +0000
> @@ -33,6 +33,18 @@
> progress=progress,
> parent=None,
> datadir=datadir)
> + elif frontend == "DistUpgradeViewKDE":
> + print("kde")
> + from DistUpgrade.DistUpgradeFetcherKDE import DistUpgradeFetcherKDE
> + from DistUpgrade.DistUpgradeFetcherKDE import KDEAcquireProgressAdapter
> + progress = KDEAcquireProgressAdapter(
> + parent=None,
> + datadir=datadir,
> + label=_("Downloading the release upgrade tool"))
> + return DistUpgradeFetcherKDE(new_dist=new_dist,
> + progress=progress,
> + parent=None,
> + datadir=datadir)
> else:
> from DistUpgrade.DistUpgradeFetcherCore import DistUpgradeFetcherCore
> import apt
>
--
https://code.launchpad.net/~kubuntu-packagers/ubuntu-release-upgrader/qt5/+merge/229620
Your team Kubuntu Packagers is subscribed to branch lp:~kubuntu-packagers/ubuntu-release-upgrader/qt5.
More information about the kubuntu-devel
mailing list