~ubuntu-branches/ubuntu/raring/hplip/raring

« back to all changes in this revision

Viewing changes to ui4/plugindialog.py

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2009-12-14 20:08:44 UTC
  • mfrom: (2.1.118 lucid)
  • Revision ID: james.westby@ubuntu.com-20091214200844-z8qhqwgppbu3t7ze
Tags: 3.9.10-4
KBSD patch from KiBi (Closes: #560796)

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
 
52
52
 
53
53
class PluginDialog(QDialog, Ui_Dialog):
54
 
    def __init__(self, parent, install_mode=PLUGIN_NONE):
 
54
    def __init__(self, parent, install_mode=PLUGIN_NONE, plugin_reason=PLUGIN_REASON_NONE):
55
55
        QDialog.__init__(self, parent)
56
56
        self.install_mode = install_mode
 
57
        self.plugin_reason = plugin_reason
57
58
        self.plugin_path = None
58
59
        self.result = False
59
60
        self.core = CoreInstall()
81
82
        # Application icon
82
83
        self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
83
84
 
 
85
        self.PLUGIN_REASON_TEXT = {
 
86
            PLUGIN_REASON_NONE: None,
 
87
            PLUGIN_REASON_PRINTING_SUPPORT: self.__tr("This plugin will enable printing support."),
 
88
            PLUGIN_REASON_FASTER_PRINTING: self.__tr("This plugin will enhance print speed."),
 
89
            PLUGIN_REASON_BETTER_PRINTING_PQ: self.__tr("This plugin will enhance print quality."),
 
90
            PLUGIN_REASON_PRINTING_FEATURES: self.__tr("This plugin will add printing features."),
 
91
            PLUGIN_REASON_RESERVED_10: None,
 
92
            PLUGIN_REASON_RESERVED_20: None,
 
93
            PLUGIN_REASON_SCANNING_SUPPORT: self.__tr("This plugin will enable scanning support."),
 
94
            PLUGIN_REASON_FASTER_SCANNING: self.__tr("This plugin will enhance scanning speed."),
 
95
            PLUGIN_REASON_BETTER_SCANNING_IQ: self.__tr("This plugin will enhance scanning image quality."),
 
96
            PLUGIN_REASON_RESERVED_200: None,
 
97
            PLUGIN_REASON_RESERVED_400: None,
 
98
            PLUGIN_REASON_FAXING_SUPPORT: self.__tr("This plugin will enable faxing support."),
 
99
            PLUGIN_REASON_FAX_FEATURES: self.__tr("This plugin will enhnace faxing features."),
 
100
            PLUGIN_REASON_RESERVED_20000: None,
 
101
            PLUGIN_REASON_RESERVED_40000: None,
 
102
        }
84
103
 
85
104
    #
86
105
    # SOURCE PAGE
87
106
    #
88
107
    def showSourcePage(self):
89
 
        if self.install_mode == PLUGIN_REQUIRED:
90
 
            self.TitleLabel.setText(self.__tr("An additional driver plug-in is required to operate this printer. You may download the plug-in directly from an HP authorized server (recommended), or, if you already have a copy of the file, you can specify a path to the file (advanced)."))
91
 
            self.SkipRadioButton.setEnabled(False)
92
 
 
93
 
        elif self.install_mode == PLUGIN_OPTIONAL:
94
 
            self.TitleLabel.setText(self.__tr("An optional driver plug-in is available to enhance the operation of this printer. You may download the plug-in directly from an HP authorized server (recommended), skip this installation (not recommended), or, if you already have a copy of the file, you can specify a path to the file (advanced)."))
 
108
        reason_text = self.plugin_reason_text()
 
109
 
 
110
        if reason_text is not None:
 
111
            if self.install_mode == PLUGIN_REQUIRED:
 
112
                self.TitleLabel.setText(self.__tr("An additional driver plug-in is required to operate this printer. You may download the plug-in directly from an HP authorized server (recommended), or, if you already have a copy of the file, you can specify a path to the file (advanced). <br><br>%1").arg(reason_text))
 
113
                self.SkipRadioButton.setEnabled(False)
 
114
 
 
115
            elif self.install_mode == PLUGIN_OPTIONAL:
 
116
                self.TitleLabel.setText(self.__tr("An optional driver plug-in is available to enhance the operation of this printer. You may download the plug-in directly from an HP authorized server (recommended), skip this installation (not recommended), or, if you already have a copy of the file, you can specify a path to the file (advanced).<br><br>%1").arg(reason_text))
95
117
 
96
118
        self.connect(self.DownloadRadioButton, SIGNAL("toggled(bool)"), self.DownloadRadioButton_toggled)
97
119
        self.connect(self.CopyRadioButton, SIGNAL("toggled(bool)"), self.CopyRadioButton_toggled)
343
365
        self.StepText.setText(self.__tr("Step %1 of %2").arg(p+1).arg(PAGE_MAX+1))
344
366
 
345
367
 
 
368
    def plugin_reason_text(self):
 
369
        try:
 
370
            return self.PLUGIN_REASON_TEXT[self.plugin_reason]
 
371
        except KeyError:
 
372
            return None
 
373
 
 
374
 
346
375
    def __tr(self,s,c = None):
347
376
        return qApp.translate("PluginDialog",s,c)
348
377