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

« back to all changes in this revision

Viewing changes to ui/devmgr4.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:
37
37
from prnt import cups
38
38
from base.codes import *
39
39
from ui_utils import load_pixmap
 
40
from installer.core_install import *
40
41
 
41
42
# Qt
42
43
from qt import *
407
408
                 initial_device_uri=None, disable_dbus=False,
408
409
                 parent=None, name=None, fl = 0):
409
410
 
410
 
        DevMgr4_base.__init__(self, parent, name, fl)
411
411
 
 
412
        # Distro insformation
 
413
        core =  CoreInstall(MODE_CHECK)
 
414
#        core.init()
 
415
        self.Is_autoInstaller_distro = core.is_auto_installer_support()
 
416
        self.Latest_ver= user_conf.get('upgrade', 'latest_available_version')
 
417
        installed_version=sys_conf.get('hplip','version')
 
418
        if utils.Is_HPLIP_older_version(installed_version, self.Latest_ver):
 
419
            DevMgr4_base.__init__(self, parent, name, fl,self.Latest_ver,self.Is_autoInstaller_distro)
 
420
        else:
 
421
            self.Latest_ver = ""
 
422
            DevMgr4_base.__init__(self, parent, name, fl,self.Latest_ver,self.Is_autoInstaller_distro)
412
423
        log.debug("Initializing toolbox UI (Qt3)...")
413
424
        log.debug("HPLIP Version: %s" % prop.installed_version)
414
425
 
599
610
              12 : self.__tr("twelve")
600
611
              }
601
612
 
 
613
        if self.Latest_ver is "":
 
614
            self.TabIndex = { self.FunctionsTab: self.UpdateFuncsTab,
 
615
                self.StatusTab: self.UpdateStatusTab,
 
616
                self.SuppliesTab: self.UpdateSuppliesTab,
 
617
                self.PrintSettingsTab: self.UpdatePrintSettingsTab,
 
618
                self.PrintJobsTab: self.UpdatePrintControlTab,
 
619
                }
 
620
        else:
 
621
            self.TabIndex = { self.FunctionsTab: self.UpdateFuncsTab,
 
622
                self.StatusTab: self.UpdateStatusTab,
 
623
                self.SuppliesTab: self.UpdateSuppliesTab,
 
624
                self.PrintSettingsTab: self.UpdatePrintSettingsTab,
 
625
                self.PrintJobsTab: self.UpdatePrintControlTab,
 
626
                self.UpgradeTab:self.UpdateUpgradeTab,
 
627
                }
602
628
 
603
 
        self.TabIndex = { self.FunctionsTab: self.UpdateFuncsTab,
604
 
                self.StatusTab: self.UpdateStatusTab,
605
 
                self.SuppliesTab: self.UpdateSuppliesTab,
606
 
                self.PrintSettingsTab: self.UpdatePrintSettingsTab,
607
 
                self.PrintJobsTab: self.UpdatePrintControlTab,
608
 
                }
609
629
 
610
630
 
611
631
    def InitialUpdate(self):
1702
1722
                    elif align_type == ALIGN_TYPE_LEDM_MANUAL:
1703
1723
                        maint.AlignType16(d, self.LoadPaperUI, self.AlignmentNumberUI)
1704
1724
 
 
1725
                    elif align_type == ALIGN_TYPE_LEDM_FF_CC_0:
 
1726
                        maint.AlignType17(d, self.LoadPaperUI, self.Align13UI)
1705
1727
                else:
1706
1728
                    self.CheckDeviceUI()
1707
1729
 
2678
2700
 
2679
2701
        self.UpdatePrintControlTab()
2680
2702
 
2681
 
 
2682
 
 
 
2703
    def UpdateUpgradeTab(self):
 
2704
        log.debug("Upgrade Tab is pressed")
 
2705
        self.InstallPushButton_lock = False
 
2706
 
 
2707
    def InstallPushButton_clicked(self):
 
2708
        if self.InstallPushButton_lock is True:
 
2709
            return
 
2710
 
 
2711
        if self.Is_autoInstaller_distro:
 
2712
            self.InstallPushButton.setEnabled(False)
 
2713
            terminal_cmd = utils.get_terminal()
 
2714
            if terminal_cmd is not None and utils.which("hp-upgrade"):
 
2715
                cmd = terminal_cmd + " 'hp-upgrade'"
 
2716
                log.debug("cmd = %s " %cmd)
 
2717
                os.system(cmd)
 
2718
            else:
 
2719
                log.error("Failed to run hp-upgrade command from terminal =%s "%terminal_cmd)
 
2720
            self.InstallPushButton.setEnabled(True)
 
2721
        else:
 
2722
            self.InstallPushButton_lock = True
 
2723
            utils.openURL("http://hplipopensource.com/hplip-web/install/manual/index.html")
 
2724
            QTimer.singleShot(1000, self.InstallPushButton_unlock)
 
2725
 
 
2726
    def InstallPushButton_unlock(self):
 
2727
        self.InstallPushButton_lock = False
2683
2728
 
2684
2729
    # ***********************************************************************************
2685
2730
    #