""" Hardware information dialog, see hardware_info.ui """ ## MODULE IMPORTS ######################################################## import commands, os, sys # Can run stand-alone KBTV_MAINPATH = os.path.dirname(os.path.abspath(sys.argv[0])) if not KBTV_MAINPATH in sys.path: sys.path.append(KBTV_MAINPATH) import btcopyright, bthardware, btdriver from kdecore import KCmdLineArgs, KApplication, i18n from qt import QObject, SIGNAL, SLOT from hardware_info import HWInfo ## MODULE COPYRIGHT ###################################################### MODULE_AUTHOR = btcopyright.MY_NAME MODULE_AUTHOR_EMAIL = btcopyright.MY_EMAIL MODULE_COPYRIGHT = btcopyright.MY_COPYRIGHT MODULE_LICENSE = btcopyright.BSD_LICENSE MODULE_LICENSE_TEXT = btcopyright.BSD_LICENSE_TEXT ## KBTVHARDWARE CLASS #################################################### class KbtvHardwareInfo(HWInfo): """ Shows a dialog with detected hardware info. """ def __init__(self, *args): """ -> KbtvHardwareInfo Creates a non-modal dialog showing detected hardware info. Uses the bthardware module for detection. Inherits HWInfo, which is generated from hardware_info.ui. Must be recreated if the driver (btdriver.use_driver) is changed. """ HWInfo.__init__(self, *args) if btdriver.use_driver == "pwc": self.groupBox_video.setTitle(i18n(" Camera ")) self.label_bktrchip.hide() self.label_chip.hide() self.groupBox_audio.hide() self.label_bktr.setText(i18n("Pwc module:")) self.label_cardname.setText(i18n("Camera vendor:")) self.label_tunertype.setText(i18n("Camera model:")) if bthardware.pwc_module_loaded(): self.label_bktrmodule.setText(i18n("Loaded")) else: self.label_bktrmodule.setText(i18n("Not loaded")) elif btdriver.use_driver == "saa": self.groupBox_video.setTitle(i18n(" TV ")) self.label_bktrchip.show() self.label_chip.show() self.groupBox_audio.show() self.label_bktr.setText(i18n("Saa module:")) self.label_cardname.setText(i18n("Card name:")) self.label_tunertype.setText(i18n("Tuner type:")) if bthardware.saa_module_loaded(): self.label_bktrmodule.setText(i18n("Loaded")) else: self.label_bktrmodule.setText(i18n("Not loaded")) else: self.groupBox_video.setTitle(i18n(" TV ")) self.label_bktrchip.show() self.label_chip.show() self.groupBox_audio.show() self.label_bktr.setText(i18n("Bktr module:")) self.label_cardname.setText(i18n("Card name:")) self.label_tunertype.setText(i18n("Tuner type:")) if bthardware.bktr_module_loaded(): self.label_bktrmodule.setText(i18n("Loaded")) else: self.label_bktrmodule.setText(i18n("Not loaded")) c = "" if btdriver.use_driver == "saa": c = bthardware.saa_chip() elif btdriver.use_driver == "bt848": c = bthardware.bktr_chip() if c: self.label_chip.setText(i18n(c)) else: self.label_chip.setText(i18n("None")) if btdriver.use_driver == "pwc": c, t = bthardware.pwc_vendor_product() self.mixerchan = "mic" elif btdriver.use_driver == "saa": c, t = bthardware.saa_card_tuner() else: c, t = bthardware.bktr_card_tuner() self.label_card.setText(i18n(c)) self.label_tuner.setText(i18n(t)) if btdriver.use_driver != "pwc": if bthardware.snd_module_loaded(): self.label_sndmodule.setText(i18n("Loaded")) else: self.label_sndmodule.setText(i18n("Not loaded")) c = bthardware.snd_chip() if c: self.label_sndchip.setText(i18n(c)) else: self.label_sndchip.setText(i18n("None")) ## END ################################################################### if __name__ == "__main__": appname = "kbtv_hardware.py" description = "PyKDE dialog displaying bktr/saa and snd info or pwc info" version = "1.2.4" KCmdLineArgs.init (sys.argv, appname, description, version) a = KApplication () QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()")) w = KbtvHardwareInfo() a.setMainWidget(w) w.show() a.exec_loop()