~ubuntu-core-dev/software-properties/main

« back to all changes in this revision

Viewing changes to softwareproperties/kde/CdromProgress.py

  • Committer: Simon Quigley
  • Date: 2018-07-14 10:11:32 UTC
  • mto: This revision was merged to the branch mainline in revision 1049.
  • Revision ID: tsimonq2@ubuntu.com-20180714101132-jpm43js9q13vplzm
Use sed to make everything say Qt.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#  Qt 4 based frontend to software-properties
2
 
#
3
 
#  Copyright (c) 2007 Canonical Ltd.
4
 
#
5
 
#  Author: Jonathan Riddell <jriddell@ubuntu.com>
6
 
#
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.
11
 
#
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.
16
 
#
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
20
 
#  USA
21
 
 
22
 
from __future__ import absolute_import, print_function
23
 
 
24
 
import apt
25
 
from PyQt5.QtCore import *
26
 
from PyQt5.QtGui import *
27
 
from gettext import gettext as _
28
 
from .I18nHelper import *
29
 
 
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()
36
 
    self.parent = parent
37
 
    self.kapp = kapp
38
 
    self.button_cdrom_close.setEnabled(False)
39
 
 
40
 
  def close(self):
41
 
    self.dialog_cdrom_progress.close()
42
 
 
43
 
  def update(self, text, step):
44
 
    """ update is called regularly so that the gui can be redrawn """
45
 
    if step > 0:
46
 
      self.dialog_cdrom_progress.setValue((step/self.totalSteps)*100)
47
 
      if step == self.totalSteps:
48
 
        self.button_cdrom_close.setEnabled(True)
49
 
    if text != "":
50
 
      self.dialog_cdrom_progress.setLabelText(text)
51
 
    self.kapp.processEvents()
52
 
 
53
 
  def askCdromName(self):
54
 
    (name, valid) = QInputDialog.getText(self.parent.userinterface, _("CD Name"), _("Please enter a name for the disc"))
55
 
    return (valid, name)
56
 
 
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:
60
 
      print("ok")
61
 
      return True
62
 
    print("cancel")
63
 
    return False