~ubuntu-branches/ubuntu/saucy/hplip/saucy-proposed

« back to all changes in this revision

Viewing changes to ui4/devmgr5.py

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2012-05-26 11:20:39 UTC
  • mfrom: (1.5.6) (31.1.3 precise)
  • Revision ID: package-import@ubuntu.com-20120526112039-bevxczegxnbyr5m7
Tags: 3.12.4-1
* New upstream release
* Switch to source/format 3.0 (quilt) - drop dpatch
* Refreshed debian/patches
* dh_autoreconf debian/autogen.sh & set local-options single-debian-patch
* Update to debian/compat -> 9
* Fix "hardened build flags" patch from Moritz - thanks (Closes: #667828)
* Fix "duplex descriptor uninitialized" patch from Matej (Closes: #583273)
* Fix "please migrate to kde-runtime" patch from Pino (Closes: #666544)

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
from base.codes import *
37
37
from ui_utils import *
38
38
import hpmudext
 
39
from installer.core_install import *
39
40
 
40
41
# Qt
41
42
from PyQt4.QtCore import *
150
151
        return qApp.translate("DevMgr5",s,c)
151
152
 
152
153
 
 
154
class DiagnoseQueue(QObject):
 
155
    def __init__(self, parent):
 
156
        self.parent = parent
 
157
 
 
158
 
 
159
    def exec_(self):
 
160
        ok, output = utils.run('hp-diagnose_queues -r')
 
161
 
 
162
    def __tr(self,s,c = None):
 
163
        return qApp.translate("DevMgr5",s,c)
 
164
 
 
165
 
153
166
 
154
167
# ***********************************************************************************
155
168
#
166
179
        log.debug("Initializing toolbox UI (Qt4)...")
167
180
        log.debug("HPLIP Version: %s" % prop.installed_version)
168
181
 
169
 
        self.setupUi(self)
170
 
 
 
182
        
171
183
        self.toolbox_version = toolbox_version
172
184
        self.initial_device_uri = initial_device_uri
173
185
        self.device_vars = {}
177
189
        self.updating = False
178
190
        self.init_failed = False
179
191
        self.service = None
 
192
        self.Is_autoInstaller_distro = False            # True-->tier1(supports auto installation).             False--> tier2(manual installation)
180
193
 
 
194
        # Distro insformation
 
195
        core =  CoreInstall(MODE_CHECK)
 
196
#        core.init()
 
197
        self.Is_autoInstaller_distro = core.is_auto_installer_support()
181
198
        # User settings
182
199
        self.user_settings = UserSettings()
183
200
        self.user_settings.load()
184
201
        self.user_settings.debug()
185
202
        self.cur_device_uri = self.user_settings.last_used_device_uri
186
 
 
 
203
        installed_version=sys_conf.get('hplip','version')
 
204
        if not utils.Is_HPLIP_older_version( installed_version,  self.user_settings.latest_available_version):
 
205
            self.setupUi(self,"",self.Is_autoInstaller_distro)
 
206
        else:
 
207
            self.setupUi(self, self.user_settings.latest_available_version,self.Is_autoInstaller_distro)
 
208
            
187
209
        # Other initialization
188
210
        self.initDBus()
189
211
        self.initPixmaps()
278
300
        self.initPrintSettingsTab()
279
301
        self.initPrintControlTab()
280
302
 
 
303
 
281
304
        self.connect(self.Tabs,SIGNAL("currentChanged(int)"),self.Tabs_currentChanged)
282
305
 
283
306
        # Resize the splitter so that the device list starts as a single column
295
318
                          2: self.updateSuppliesTab,
296
319
                          3: self.updatePrintSettingsTab,
297
320
                          4: self.updatePrintControlTab,
 
321
                          5:self.updateHPLIPupgrade,
298
322
                        }
299
323
 
300
324
        # docs
1143
1167
                    "plugin",
1144
1168
                    x,
1145
1169
                    lambda : PluginInstall(self, d.plugin, plugin_installed)),
 
1170
                    
 
1171
                    # Diagnose Queues
 
1172
                    (lambda : True,
 
1173
                    self.__tr("Diagnose Queues"),
 
1174
                    "warning",
 
1175
                    self.__tr("Diagnose Print/Fax Queues."),
 
1176
                    lambda : DiagnoseQueue(self)),
1146
1177
 
1147
1178
                    # EWS
1148
1179
 
1739
1770
        # TODO: Check queues at startup and send events if stopped or rejecting
1740
1771
 
1741
1772
 
 
1773
    def initUpgradeTab(self):
 
1774
        self.connect(self.InstallLatestButton, SIGNAL("clicked()"), self.InstallLatestButton_clicked)
 
1775
        self.InstallLatestButton_lock = False
 
1776
        
 
1777
       
 
1778
    def InstallLatestButton_clicked(self):
 
1779
        if self.InstallLatestButton_lock is True:
 
1780
            return
 
1781
        if self.Is_autoInstaller_distro:
 
1782
            self.InstallLatestButton.setEnabled(False)
 
1783
            terminal_cmd = utils.get_terminal()
 
1784
            if terminal_cmd is not None and utils.which("hp-upgrade"):
 
1785
                cmd = terminal_cmd + " 'hp-upgrade'"
 
1786
                log.debug("cmd = %s " %cmd)
 
1787
                os.system(cmd)
 
1788
            else:
 
1789
                log.error("Failed to run hp-upgrade command from terminal =%s "%terminal_cmd)
 
1790
            self.InstallLatestButton.setEnabled(True)
 
1791
        else:
 
1792
            self.InstallLatestButton_lock = True
 
1793
            utils.openURL("http://hplipopensource.com/hplip-web/install/manual/index.html")
 
1794
            QTimer.singleShot(1000, self.InstallLatestButton_unlock)
 
1795
 
 
1796
 
 
1797
    def InstallLatestButton_unlock(self):
 
1798
        self.InstallLatestButton_lock = False
 
1799
 
 
1800
 
1742
1801
    def CancelJobButton_clicked(self):
1743
1802
        item = self.JobTable.currentItem()
1744
1803
 
1752
1811
    def RefreshButton_clicked(self):
1753
1812
        self.updatePrintControlTab()
1754
1813
 
 
1814
    def  updateHPLIPupgrade(self):
 
1815
        self.initUpgradeTab()
1755
1816
 
 
1817
        
 
1818
        
 
1819
        
1756
1820
    def updatePrintControlTab(self):
1757
1821
        if self.cur_device.device_type == DEVICE_TYPE_PRINTER:
1758
1822
            self.PrintControlPrinterNameLabel.setText(self.__tr("Printer Name:"))