1
# Qt 4 based frontend to software-properties
3
# Copyright (c) 2007 Canonical Ltd.
5
# Author: Jonathan Riddell <jriddell@ubuntu.com>
7
# This program is free software; you can redistribute it and/or
8
# modify it under the terms of the GNU General Public License as
9
# published by the Free Software Foundation; either version 2 of the
10
# License, or (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program; if not, write to the Free Software
19
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22
from __future__ import absolute_import, print_function
25
from PyQt5.QtCore import *
26
from PyQt5.QtGui import *
27
from gettext import gettext as _
28
from .I18nHelper import *
30
class CdromProgress(apt.progress.base.CdromProgress):
31
def __init__(self, datadir, parent, kapp):
32
self.dialog_cdrom_progress = QProgressDialog(parent.userinterface)
33
self.button_cdrom_close = QPushButton("Close", None)
34
self.dialog_cdrom_progress.setCancelButton(self.button_cdrom_close)
35
self.dialog_cdrom_progress.show()
38
self.button_cdrom_close.setEnabled(False)
41
self.dialog_cdrom_progress.close()
43
def update(self, text, step):
44
""" update is called regularly so that the gui can be redrawn """
46
self.dialog_cdrom_progress.setValue((step/self.totalSteps)*100)
47
if step == self.totalSteps:
48
self.button_cdrom_close.setEnabled(True)
50
self.dialog_cdrom_progress.setLabelText(text)
51
self.kapp.processEvents()
53
def askCdromName(self):
54
(name, valid) = QInputDialog.getText(self.parent.userinterface, _("CD Name"), _("Please enter a name for the disc"))
57
def changeCdrom(self):
58
result = QMessageBox.question(self.parent.userinterface, _("Insert Disk"), _("Please insert a disk in the drive:"), QMessageBox.Ok|QMessageBox.Cancel)
59
if result == QMessageBox.Ok: