diff options
author | Didier Raboud <odyx@debian.org> | 2016-01-06 12:07:39 +0100 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2016-01-06 12:07:39 +0100 |
commit | b6f7e80d1279447768d86f7ad3c19a7e71d91ab4 (patch) | |
tree | 522ba6ec0a38fb29a7d948696f7d126dd1e6e6f0 /ui | |
parent | 78face2d666d0863ffc0f5e2fd54a68418eea46e (diff) |
Imported Upstream version 3.12.4
Diffstat (limited to 'ui')
-rw-r--r-- | ui/devmgr4.py | 51 | ||||
-rw-r--r-- | ui/devmgr4_base.py | 40 | ||||
-rw-r--r-- | ui/devmgr4_base.ui | 56 | ||||
-rw-r--r-- | ui/scrollcopy.py | 14 | ||||
-rw-r--r-- | ui/setupform.py | 18 | ||||
-rw-r--r-- | ui/systemtray.py | 38 | ||||
-rw-r--r-- | ui/upgradeform.py | 136 | ||||
-rw-r--r-- | ui/upgradeform_base.py | 86 |
8 files changed, 416 insertions, 23 deletions
diff --git a/ui/devmgr4.py b/ui/devmgr4.py index e1b132e6f..8a33558dd 100644 --- a/ui/devmgr4.py +++ b/ui/devmgr4.py @@ -37,6 +37,7 @@ from base import device, utils, pml, maint, pkit from prnt import cups from base.codes import * from ui_utils import load_pixmap +from installer.core_install import * # Qt from qt import * @@ -407,8 +408,18 @@ class DevMgr4(DevMgr4_base): initial_device_uri=None, disable_dbus=False, parent=None, name=None, fl = 0): - DevMgr4_base.__init__(self, parent, name, fl) + # Distro insformation + core = CoreInstall(MODE_CHECK) +# core.init() + self.Is_autoInstaller_distro = core.is_auto_installer_support() + self.Latest_ver= user_conf.get('upgrade', 'latest_available_version') + installed_version=sys_conf.get('hplip','version') + if utils.Is_HPLIP_older_version(installed_version, self.Latest_ver): + DevMgr4_base.__init__(self, parent, name, fl,self.Latest_ver,self.Is_autoInstaller_distro) + else: + self.Latest_ver = "" + DevMgr4_base.__init__(self, parent, name, fl,self.Latest_ver,self.Is_autoInstaller_distro) log.debug("Initializing toolbox UI (Qt3)...") log.debug("HPLIP Version: %s" % prop.installed_version) @@ -599,13 +610,22 @@ class DevMgr4(DevMgr4_base): 12 : self.__tr("twelve") } - - self.TabIndex = { self.FunctionsTab: self.UpdateFuncsTab, + if self.Latest_ver is "": + self.TabIndex = { self.FunctionsTab: self.UpdateFuncsTab, self.StatusTab: self.UpdateStatusTab, self.SuppliesTab: self.UpdateSuppliesTab, self.PrintSettingsTab: self.UpdatePrintSettingsTab, self.PrintJobsTab: self.UpdatePrintControlTab, } + else: + self.TabIndex = { self.FunctionsTab: self.UpdateFuncsTab, + self.StatusTab: self.UpdateStatusTab, + self.SuppliesTab: self.UpdateSuppliesTab, + self.PrintSettingsTab: self.UpdatePrintSettingsTab, + self.PrintJobsTab: self.UpdatePrintControlTab, + self.UpgradeTab:self.UpdateUpgradeTab, + } + def InitialUpdate(self): @@ -1702,6 +1722,8 @@ class DevMgr4(DevMgr4_base): elif align_type == ALIGN_TYPE_LEDM_MANUAL: maint.AlignType16(d, self.LoadPaperUI, self.AlignmentNumberUI) + elif align_type == ALIGN_TYPE_LEDM_FF_CC_0: + maint.AlignType17(d, self.LoadPaperUI, self.Align13UI) else: self.CheckDeviceUI() @@ -2678,8 +2700,31 @@ class DevMgr4(DevMgr4_base): self.UpdatePrintControlTab() + def UpdateUpgradeTab(self): + log.debug("Upgrade Tab is pressed") + self.InstallPushButton_lock = False + + def InstallPushButton_clicked(self): + if self.InstallPushButton_lock is True: + return + if self.Is_autoInstaller_distro: + self.InstallPushButton.setEnabled(False) + terminal_cmd = utils.get_terminal() + if terminal_cmd is not None and utils.which("hp-upgrade"): + cmd = terminal_cmd + " 'hp-upgrade'" + log.debug("cmd = %s " %cmd) + os.system(cmd) + else: + log.error("Failed to run hp-upgrade command from terminal =%s "%terminal_cmd) + self.InstallPushButton.setEnabled(True) + else: + self.InstallPushButton_lock = True + utils.openURL("http://hplipopensource.com/hplip-web/install/manual/index.html") + QTimer.singleShot(1000, self.InstallPushButton_unlock) + def InstallPushButton_unlock(self): + self.InstallPushButton_lock = False # *********************************************************************************** # diff --git a/ui/devmgr4_base.py b/ui/devmgr4_base.py index 30bf95bd7..49b7f8477 100644 --- a/ui/devmgr4_base.py +++ b/ui/devmgr4_base.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'devmgr4_base.ui' +# Form implementation generated from reading ui file 'ui/devmgr4_base.ui' # -# Created: Mon Apr 28 10:56:51 2008 -# by: The PyQt User Interface Compiler (pyuic) 3.17.3 +# Created: Fri Feb 3 12:00:32 2012 +# by: The PyQt User Interface Compiler (pyuic) 3.18.1 # # WARNING! All changes made in this file will be lost! @@ -12,13 +12,15 @@ from qt import * class DevMgr4_base(QMainWindow): - def __init__(self,parent = None,name = None,fl = 0): + def __init__(self,parent = None,name = None,fl = 0,latest_available_version="",Is_autoInstaller_distro=False): QMainWindow.__init__(self,parent,name,fl) self.statusBar() if not name: self.setName("DevMgr4_base") + self.latest_available_version= latest_available_version + self.Is_autoInstaller_distro= Is_autoInstaller_distro self.setCentralWidget(QWidget(self,"qt_central_widget")) DevMgr4_baseLayout = QGridLayout(self.centralWidget(),1,1,11,6,"DevMgr4_baseLayout") @@ -178,6 +180,28 @@ class DevMgr4_base(QMainWindow): PrintJobsTabLayout.addWidget(self.printerTextLabel,0,1) self.Tabs.insertTab(self.PrintJobsTab,QString.fromLatin1("")) + if self.latest_available_version is not "": + self.UpgradeTab = QWidget(self.Tabs,"UpgradeTab") + self.UpgradeLabel = QLabel(self.UpgradeTab,"UpgradeLabel") + msg="Latest 'HPLIP-%s' version available for Installation"%self.latest_available_version + self.UpgradeLabel.setText(self.__tr(msg)) + self.UpgradeLabel.setGeometry(QRect(17,43,330,20)) + if self.Is_autoInstaller_distro: + self.InstallPushButton = QPushButton(self.UpgradeTab,"InstallPushButton") + self.InstallPushButton.setText(self.__tr("Install Now")) + self.InstallPushButton.setGeometry(QRect(390,40,111,30)) + else: + self.ManualInfoLabel = QLabel(self.UpgradeTab,"ManualInfoLabel") + msg="Please install manually as mentioned in " + self.ManualInfoLabel.setText(self.__tr(msg)) + self.ManualInfoLabel.setGeometry(QRect(17,70,300,30)) + + self.InstallPushButton = QPushButton(self.UpgradeTab,"InstallPushButton") + self.InstallPushButton.setText(self.__tr("HPLIP website")) + self.InstallPushButton.setGeometry(QRect(260,70,100,25)) + + self.Tabs.insertTab(self.UpgradeTab,QString.fromLatin1("")) + DevMgr4_baseLayout.addWidget(self.splitter2,0,0) @@ -266,7 +290,8 @@ class DevMgr4_base(QMainWindow): self.connect(self.infoToolButton,SIGNAL("clicked()"),self.infoToolButton_clicked) self.connect(self.cancelToolButton,SIGNAL("clicked()"),self.cancelToolButton_clicked) self.connect(self.jobList,SIGNAL("contextMenuRequested(QListViewItem*,const QPoint&,int)"),self.jobList_contextMenuRequested) - + if self.latest_available_version is not "": + self.connect(self.InstallPushButton,SIGNAL("clicked()"),self.InstallPushButton_clicked) def languageChange(self): self.setCaption(self.__tr("HP Device Manager")) @@ -299,6 +324,8 @@ class DevMgr4_base(QMainWindow): self.stopstartPushButton.setText(self.__tr("Stop Printer")) self.printerTextLabel.setText(self.__tr("Printer Name:")) self.Tabs.changeTab(self.PrintJobsTab,self.__tr("Print Control")) + if self.latest_available_version is not "": + self.Tabs.changeTab(self.UpgradeTab,self.__tr("Upgrade")) self.helpContentsAction.setText(self.__tr("Contents")) self.helpContentsAction.setMenuText(self.__tr("&Contents...")) self.helpContentsAction.setToolTip(self.__tr("Help Contents (F1)")) @@ -539,6 +566,9 @@ class DevMgr4_base(QMainWindow): def cancelToolButton_clicked(self): print "DevMgr4_base.cancelToolButton_clicked(): Not implemented yet" + def InstallPushButton_clicked(self): + print "DevMgr4_base.InstallPushButton_clicked(): Not implemented yet" + def jobList_contextMenuRequested(self,a0,a1,a2): print "DevMgr4_base.jobList_contextMenuRequested(QListViewItem*,const QPoint&,int): Not implemented yet" diff --git a/ui/devmgr4_base.ui b/ui/devmgr4_base.ui index b2864f29d..31c58b734 100644 --- a/ui/devmgr4_base.ui +++ b/ui/devmgr4_base.ui @@ -616,6 +616,62 @@ </widget> </grid> </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>Upgrade</string> + </attribute> + <widget class="QPushButton"> + <property name="name"> + <cstring>pushButton4</cstring> + </property> + <property name="geometry"> + <rect> + <x>390</x> + <y>40</y> + <width>111</width> + <height>30</height> + </rect> + </property> + <property name="text"> + <string>pushButton4</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="geometry"> + <rect> + <x>17</x> + <y>43</y> + <width>330</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>textLabel1</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="geometry"> + <rect> + <x>11</x> + <y>91</y> + <width>480</width> + <height>70</height> + </rect> + </property> + <property name="text"> + <string>textLabel2</string> + </property> + </widget> + </widget> </widget> </widget> </grid> diff --git a/ui/scrollcopy.py b/ui/scrollcopy.py index 194dbcc49..a6afaf77a 100644 --- a/ui/scrollcopy.py +++ b/ui/scrollcopy.py @@ -66,7 +66,7 @@ class ScrollCopyView(ScrollView): if self.quality is None: result_code, self.quality = self.dev.getPML(pml.OID_COPIER_QUALITY) - if self.scan_style == SCAN_STYLE_FLATBED and self.fit_to_page is None: + if self.scan_src == SCAN_SRC_FLATBED and self.fit_to_page is None: result_code, self.fit_to_page = self.dev.getPML(pml.OID_COPIER_FIT_TO_PAGE) if result_code != pml.ERROR_OK: @@ -76,7 +76,7 @@ class ScrollCopyView(ScrollView): else: self.fit_to_page = pml.COPIER_FIT_TO_PAGE_DISABLED - if self.scan_style != SCAN_STYLE_FLATBED: + if self.scan_src != SCAN_SRC_FLATBED: self.fitToPageCheckBox.setEnabled(False) result_code, self.max_reduction = self.dev.getPML(pml.OID_COPIER_REDUCTION_MAXIMUM) @@ -161,7 +161,7 @@ class ScrollCopyView(ScrollView): s = 'Disabled' # 1 log.debug("Default Fit to page: %s (%s)" % (self.fit_to_page, s)) - log.debug("Scan style (models.dat: scan-style): %d" % self.scan_style) + log.debug("Scan src (models.dat: scan-src): %d" % self.scan_src) finally: self.dev.closePML() @@ -200,10 +200,10 @@ class ScrollCopyView(ScrollView): self.dev = copier.PMLCopyDevice(device_uri=self.cur_device.device_uri, printer_name=self.cur_printer) - self.scan_style = self.dev.mq.get('scan-style', SCAN_STYLE_FLATBED) + self.scan_src = self.dev.mq.get('scan-src', SCAN_SRC_FLATBED) self.copy_type = self.dev.mq.get('copy-type', COPY_TYPE_DEVICE) - if self.scan_style == SCAN_STYLE_SCROLLFED: + if self.scan_src == SCAN_SRC_SCROLLFED: self.fitToPageCheckBox.setEnabled(False) self.fit_to_page = pml.COPIER_FIT_TO_PAGE_DISABLED @@ -524,7 +524,7 @@ class ScrollCopyView(ScrollView): s = 'Disabled' # 1 log.debug("Fit to page: %s (%s)" % (self.fit_to_page, s)) - log.debug("Scan style: %d" % self.scan_style) + log.debug("Scan src: %d" % self.scan_src) # Open the dialog box. # @@ -536,7 +536,7 @@ class ScrollCopyView(ScrollView): self.copy_timer.start(1000) # 1 sec UI updates self.dev.copy(self.num_copies, self.contrast, self.reduction, - self.quality, self.fit_to_page, self.scan_style, + self.quality, self.fit_to_page, self.scan_src, self.update_queue, self.event_queue) finally: diff --git a/ui/setupform.py b/ui/setupform.py index a3f00853d..a2e56b599 100644 --- a/ui/setupform.py +++ b/ui/setupform.py @@ -237,12 +237,12 @@ class SetupForm(SetupForm_base): core.set_plugin_version() plugin = self.mq.get('plugin', PLUGIN_NONE) plugin_reason = self.mq.get('plugin-reason', PLUGIN_REASON_NONE) - if plugin > PLUGIN_NONE and not core.check_for_plugin(): + if plugin > PLUGIN_NONE and core.check_for_plugin() != PLUGIN_INSTALLED: ok, sudo_ok = pkit.run_plugin_command(plugin == PLUGIN_REQUIRED, plugin_reason) if not sudo_ok: self.FailureUI(self.__tr("<b>Unable to find an appropriate su/sudo utility to run hp-plugin.</b><p>Install kdesu, gnomesu, or gksu.</p>")) return - if not ok or not core.check_for_plugin(): + if not ok or core.check_for_plugin() != PLUGIN_INSTALLED: if plugin == PLUGIN_REQUIRED: self.FailureUI(self.__tr("<b>The printer you are trying to setup requires a binary driver plug-in and it failed to install.</b><p>Please check your internet connection and try again.</p><p>Visit <u>http://hplipopensource.com</u> for more information.</p>")) return @@ -606,13 +606,14 @@ class SetupForm(SetupForm_base): printer_name = default_model + installed_printer_names = device.getSupportedCUPSPrinterNames(['hp']) # Check for duplicate names - if self.device_uri in self.installed_print_devices and \ - printer_name in self.installed_print_devices[self.device_uri]: + if (self.device_uri in self.installed_print_devices and printer_name in self.installed_print_devices[self.device_uri]) \ + or (printer_name in installed_printer_names): i = 2 while True: t = printer_name + "_%d" % i - if t not in self.installed_print_devices[self.device_uri]: + if (t not in installed_printer_names) and (self.device_uri not in self.installed_print_devices or t not in self.installed_print_devices[self.device_uri]): printer_name += "_%d" % i break i += 1 @@ -713,15 +714,16 @@ class SetupForm(SetupForm_base): default_model = utils.xstrip(model.replace('series', '').replace('Series', ''), '_') fax_name = default_model + "_fax" + installed_fax_names = device.getSupportedCUPSPrinterNames(['hpfax']) # Check for duplicate names - if self.fax_uri in self.installed_fax_devices and \ - fax_name in self.installed_fax_devices[self.fax_uri]: + if (self.fax_uri in self.installed_fax_devices and fax_name in self.installed_fax_devices[self.fax_uri]) \ + or (fax_name in installed_fax_names): #if fax_name in self.installed_queues or fax_name == self.printer_name: i = 2 while True: t = fax_name + "_%d" % i - if t not in self.installed_fax_devices[self.fax_uri]: + if (t not in installed_fax_names) and (self.fax_uri not in self.installed_fax_devices or t not in self.installed_fax_devices[self.fax_uri]): fax_name += "_%d" % i break i += 1 diff --git a/ui/systemtray.py b/ui/systemtray.py index cde1b869b..814544353 100644 --- a/ui/systemtray.py +++ b/ui/systemtray.py @@ -70,6 +70,7 @@ TrayIcon_Critical = 1 TrayIcon_Information = 2 theBalloonTip = None +UPGRADE_CHECK_DELAY=24*60*60*1000 #1 day class BalloonTip(QDialog): @@ -392,6 +393,10 @@ class SystemTrayApp(QApplication): self.read_pipe = read_pipe self.fmt = "80s80sI32sI80sf" self.fmt_size = struct.calcsize(self.fmt) + + self.user_settings = utils.UserSettings() + self.user_settings.load() + self.user_settings.debug() self.tray_icon = SystrayIcon(load_pixmap("hp_logo", "32x32", (22, 22))) self.menu = QPopupMenu() @@ -423,6 +428,11 @@ class SystemTrayApp(QApplication): self.icon_info = load_pixmap('info', '16x16') self.icon_warn = load_pixmap('warning', '16x16') self.icon_error = load_pixmap('error', '16x16') + + self.handle_hplip_updation() + self.timer = QTimer() + self.timer.connect(self.timer,SIGNAL("timeout()"),self.handle_hplip_updation) + self.timer.start(UPGRADE_CHECK_DELAY) self.ERROR_STATE_TO_ICON = { ERROR_STATE_CLEAR: self.icon_info, @@ -519,6 +529,34 @@ class SystemTrayApp(QApplication): else: break + def handle_hplip_updation(self): + log.debug("handle_hplip_updation upgrade_notify =%d"%(self.user_settings.upgrade_notify)) + path = utils.which('hp-upgrade') + if self.user_settings.upgrade_notify is False: + log.debug("upgrade notification is disabled in systray ") + if path: + path = os.path.join(path, 'hp-upgrade') + log.debug("Running hp-upgrade: %s " % (path)) + # this just updates the available version in conf file. But won't notify + os.spawnlp(os.P_NOWAIT, path, 'hp-upgrade', '--check') + return + + + current_time = time.time() + + if int(current_time) > self.user_settings.upgrade_pending_update_time: + path = utils.which('hp-upgrade') + if path: + path = os.path.join(path, 'hp-upgrade') + log.debug("Running hp-upgrade: %s " % (path)) + os.spawnlp(os.P_NOWAIT, path, 'hp-upgrade', '--notify') + + else: + log.error("Unable to find hp-upgrade --notify on PATH.") + else: + log.debug("upgrade schedule time is not yet completed. schedule time =%d current time =%d " %(self.user_settings.upgrade_pending_update_time, current_time)) + + def __tr(self,s,c = None): return qApp.translate("SystemTrayApp",s,c) diff --git a/ui/upgradeform.py b/ui/upgradeform.py new file mode 100644 index 000000000..2b9814fb9 --- /dev/null +++ b/ui/upgradeform.py @@ -0,0 +1,136 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# (c) Copyright 2001-2012 Hewlett-Packard Development Company, L.P. +# +# 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, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Author: Don Welch, Goutam Korra, Naga Samrat Chowdary Narla, + +# Std Lib +import sys +import re +import os.path, os +import time + +# Local +from base.g import * +from base import device, utils, models +from ui_utils import load_pixmap + +# Qt +from qt import * +from upgradeform_base import UpgradeForm_base + +MANUAL_INSTALL_LINK = "http://hplipopensource.com/hplip-web/install/manual/index.html" + +class UpgradeForm(UpgradeForm_base): + def __init__(self, parent=None, name="",modal=0, fl=0,distro_type= 1,msg=""): + UpgradeForm_base.__init__(self, parent, name, modal, fl,distro_type, msg) + + self.msg = msg + self.distro_type = distro_type + self.setIcon(load_pixmap('hp_logo', '128x128')) + self.initUi() + + def initUi(self): + self.connect(self.NextButton,SIGNAL('clicked()'),self.NextButton_clicked) + self.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked) + +# self.connect(self.installRadioBtton, SIGNAL("toggled(bool)"), self.installRadioBtton_toggled) +# self.connect(self.remindRadioBtton, SIGNAL("toggled(bool)"), self.remindRadioBtton_toggled) +# self.connect(self.dontRemindRadioBtton, SIGNAL("toggled(bool)"), self.dontRemindRadioBtton_toggled) + + + def installRadioBtton_toggled(self, radio_enabled): + log.info("+++++++ installRadioBtton_toggled = %d" %radio_enabled) + if radio_enabled is True: + self.installRadioBtton.setChecked(True) + else: + self.installRadioBtton.setChecked(False) + + + def remindRadioBtton_toggled(self, radio_enabled): + log.info("+++++++ remindRadioBtton_toggled = %d" %radio_enabled) + if radio_enabled is True: + self.remindRadioBtton.setChecked(True) + self.daysSpinBox.setEnabled(True) + else: + self.remindRadioBtton.setChecked(False) + self.daysSpinBox.setEnabled(False) + + + def dontRemindRadioBtton_toggled(self, radio_enabled): + log.info("+++++++ dontRemindRadioBtton_toggled = %d" %radio_enabled) + if radio_enabled is True: + self.dontRemindRadioBtton.setChecked(True) + else: + self.dontRemindRadioBtton.setChecked(False) + + + def NextButton_clicked (self): + if self.dontRemindRadioBtton.isChecked(): + log.debug("HPLIP Upgrade, selected Don't remind again radiobutton") + user_conf.set('upgrade', 'notify_upgrade', 'false') + msg= "Check for HPLIP updates is disabled. To Upgrade again, check it in 'HP-toolbox' " + self.SuccessUI( self.__tr(msg)) + elif self.remindRadioBtton.isChecked(): + schedule_days = str(self.daysSpinBox.value()) + log.debug("HPLIP Upgrade, selected remind later radiobutton days= %d" %(int(schedule_days))) + next_time = time.time() + (int(schedule_days) *24 * 60 *60) + user_conf.set('upgrade', 'pending_upgrade_time', str(int(next_time))) + else: + log.debug("HPLIP Upgrade, selected Install radiobutton distro_type=%d" %self.distro_type) + self.NextButton.setEnabled(False) + if self.distro_type != 1: # not tier 1 distro + utils.openURL(MANUAL_INSTALL_LINK) + else: + terminal_cmd = utils.get_terminal() + if terminal_cmd is not None and utils.which("hp-upgrade"): + cmd = terminal_cmd + " 'hp-upgrade '" + log.debug("cmd = %s " %cmd) + os.system(cmd) + self.result = True + else: + log.error("Failed to run hp-upgrade command from terminal =%s "%terminal_cmd) + self.FailureUI( self.__tr("Failed to run hp-upgrade")) + + self.close() + + + def CancelButton_clicked(self): + log.debug("User exit") + self.close() + + + def FailureUI(self, error_text): + QMessageBox.critical(self, + self.caption(), + error_text, + QMessageBox.Ok, + QMessageBox.NoButton, + QMessageBox.NoButton) + + def SuccessUI(self, text): + QMessageBox.information(self, + self.caption(), + text, + QMessageBox.Ok, + QMessageBox.NoButton, + QMessageBox.NoButton) + + + def __tr(self,s,c = None): + return qApp.translate("UpgradeDialog",s,c) diff --git a/ui/upgradeform_base.py b/ui/upgradeform_base.py new file mode 100644 index 000000000..803ba7bd0 --- /dev/null +++ b/ui/upgradeform_base.py @@ -0,0 +1,86 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'ui/upgradeform_base.ui' +# +# Created: Thu Feb 9 20:00:42 2012 +# by: The PyQt User Interface Compiler (pyuic) 3.18.1 +# +# WARNING! All changes made in this file will be lost! + + +from qt import * + + +class UpgradeForm_base(QDialog): + def __init__(self,parent = None,name = "",modal = 0,fl = 0,distro_type =1 , msg="" ): + QDialog.__init__(self,parent,name,modal,fl) + + if name == "": + self.setName("HPLIP_Upgrade") + self.msg=msg + self.distro_type = distro_type + + self.textLabel1 = QLabel(self,"textLabel1") + self.textLabel1.setGeometry(QRect(10,10,310,50)) + + + self.buttonGroup1 = QButtonGroup(self,"buttonGroup1") + self.buttonGroup1.setGeometry(QRect(10,60,300,110)) + + self.installRadioBtton = QRadioButton(self.buttonGroup1,"installRadioBtton") + self.installRadioBtton.setGeometry(QRect(10,20,250,20)) + self.installRadioBtton.setChecked(True) + + + self.remindRadioBtton = QRadioButton(self.buttonGroup1,"remindRadioBtton") + self.remindRadioBtton.setGeometry(QRect(10,50,130,20)) + + + self.daysSpinBox = QSpinBox(self.buttonGroup1,"daysSpinBox") + self.daysSpinBox.setGeometry(QRect(139,50,50,20)) + self.daysSpinBox.setMinValue(1) + self.daysSpinBox.setMaxValue(365) +# self.daysSpinBox.setEnabled(False) + + + self.daysLabel = QLabel(self.buttonGroup1,"daysLabel") + + self.daysLabel.setGeometry(QRect(200,50,68,20)) + + + self.dontRemindRadioBtton = QRadioButton(self.buttonGroup1,"dontRemindRadioBtton") + self.dontRemindRadioBtton.setGeometry(QRect(10,80,160,20)) + + + self.NextButton = QPushButton(self,"NextButton") + self.NextButton.setGeometry(QRect(140,190,90,25)) + + self.CancelButton = QPushButton(self,"CancelButton") + self.CancelButton.setGeometry(QRect(240,190,80,25)) + + self.languageChange() + self.resize(QSize(328,225).expandedTo(self.minimumSizeHint())) + self.clearWState(Qt.WState_Polished) + + self.connect(self.daysSpinBox,SIGNAL("valueChanged(int)"),self.daysSpinBox_change) + + def daysSpinBox_change(self): + self.remindRadioBtton.setChecked(True) + + def languageChange(self): + self.setCaption(self.__tr("HPLIP Upgrade Manager")) + self.textLabel1.setText(self.__tr(self.msg)) + if self.distro_type == 1: + self.installRadioBtton.setText(self.__tr("Download and Install")) + else: + self.installRadioBtton.setText(self.__tr("Follow steps from www.hplip.net")) + self.remindRadioBtton.setText(self.__tr("Remind me after")) + self.daysLabel.setText(self.__tr("days")) + self.dontRemindRadioBtton.setText(self.__tr("Don't remind again")) + self.NextButton.setText(self.__tr("Ok")) + self.CancelButton.setText(self.__tr("Cancel")) + + + + def __tr(self,s,c = None): + return qApp.translate("Form1",s,c) |