コード例 #1
0
    def on_click(self, widget, pkgname, pkgmod):
        
        iface = init_dbus()
        if self.has_state:
            if lsmod(pkgmod):
                if self.show_dialog():
                    '''set timeout is 600s, the default is 25s'''
                    iface.install(pkgname, environ(), timeout=600)
            else:
                 iface.install(pkgname, environ(), timeout=600)
        else:
            iface.uninstall(pkgname, environ(), timeout=600)

        self.judge_install(pkgname)
        iface.quit_loop()
コード例 #2
0
def cpu_sensor():
    #info = get_output("lsmod")
    #coretemp = re.findall("coretemp",info)
    try:
        get_output('lsmod | grep -w coretemp')
    except:
        iface = init_dbus()
        iface.modprobe()
        iface.quit_loop()
    try:
        import lshw
        temp = lshw.sensors()
        return temp
    except:
        return ""
コード例 #3
0
ファイル: syscall.py プロジェクト: Allenhui89/devicemanage
def cpu_sensor():
    #info = get_output("lsmod")
    #coretemp = re.findall("coretemp",info)
    try:
        get_output('lsmod | grep -w coretemp')
    except:
        iface = init_dbus()
	iface.modprobe()
	iface.quit_loop()
    try:
	import lshw
	temp = lshw.sensors()
	return temp
    except:
	return ""
コード例 #4
0
    def on_click(self, widget, pkgname, pkgmod):

        iface = init_dbus()
        if self.has_state:
            if lsmod(pkgmod):
                if self.show_dialog():
                    '''set timeout is 600s, the default is 25s'''
                    iface.install(pkgname, environ(), timeout=600)
            else:
                iface.install(pkgname, environ(), timeout=600)
        else:
            iface.uninstall(pkgname, environ(), timeout=600)

        self.judge_install(pkgname)
        iface.quit_loop()
コード例 #5
0
ファイル: ydm_cmd.py プロジェクト: yinjie-zhang/devicemanager
    def get_db_handlers(self, hardware):

        flag = False
        iface = init_dbus()

        for hwid in hardware:
            dids = self._do_query(hwid)
            if not dids:
                continue

            for did in dids:
                flag = True
                print _(
                    "There are new or updated drivers available for your hardware:\nDriver name:\t%s\nDriver packages:%s\nVersion number:\t%s\nDescription:\t%s"
                ) % (did["kernel_module"], did["package"][0],
                     did["package"][1], did["package"][2])
                put = raw_input(
                    _("Do you want to update or install the driver(Y/N):"))
                while put.upper() != "Y" and put.upper() != "N" and put.upper(
                ) != "YES" and put.upper() != "NO":
                    put = raw_input(_("Input error, please re-enter(Y/N):"))
                    print put.upper()

                if put.upper() == "Y" or put.upper() == "YES":

                    status, output = None, None
                    if not os.environ.get('DISPLAY'):
                        cmd = "sudo yget --install -y %s" % did["package"][0]
                        (status, output) = commands.getstatusoutput(cmd)
                        if status:
                            print _("Install failed:%s") % str(output)
                        else:
                            print str(output)
                    else:
                        '''set timeout is 600s, the default is 25s'''
                        iface.install(did["package"][0],
                                      environ(),
                                      timeout=600)

        iface.quit_loop()
        if not flag:
            print _("No proprietary drivers are in use on this system.")
コード例 #6
0
ファイル: libdevice.py プロジェクト: Allenhui89/devicemanage
    def run(self):
        '''Wait'''
        self.base.framebox.add(self.load_wait(self.base, "Loading, please wait ..."))

	if not os.path.isfile(HW_XML) or not os.path.getsize(HW_XML) or self.flag == "DET":
            '''set timeout is 600s, the default is 25s'''
            iface = init_dbus()
            data = iface.scan_device(timeout=600)
            with open(HW_XML,"w") as fp:
                fp.write(data)
            iface.quit_loop()
            
	device = Device(HW_XML)
	self.dev_dict = device.dev_type
        self.base.pcid = device.pcid
        
	self.base.device_page = DevicePage(self.dev_dict, self.base)
        self.emit('load-wait')
	self.base.select_page(DEV_ID)
        self.base.lock = False
コード例 #7
0
    def run(self):
        '''Wait'''
        self.base.framebox.add(self.load_wait(self.base, "Loading, please wait ..."))

	if not os.path.isfile(HW_XML) or not os.path.getsize(HW_XML) or self.flag == "DET":
            '''set timeout is 600s, the default is 25s'''
            iface = init_dbus()
            data = iface.scan_device(timeout=600)
            with open(HW_XML, "w") as fp:
                fp.write(data)
            iface.quit_loop()
            
	device = Device(HW_XML)
	self.dev_dict = device.dev_type
        self.base.pcid = device.pcid
        
	self.base.device_page = DevicePage(self.dev_dict, self.base)
        self.emit('load-wait')
	self.base.select_page(DEV_ID)
        self.base.lock = False
コード例 #8
0
ファイル: ydm_cmd.py プロジェクト: Match-Yang/device-manager
    def get_db_handlers(self, hardware):

        flag = False
        iface = init_dbus()

        for hwid in hardware:
            dids = self._do_query(hwid)
            if not dids:
                continue

            for did in dids:
                flag = True
                print _(
                    "There are new or updated drivers available for your hardware:\nDriver name:\t%s\nDriver packages:%s\nVersion number:\t%s\nDescription:\t%s"
                ) % (did["kernel_module"], did["package"][0], did["package"][1], did["package"][2])
                put = raw_input(_("Do you want to update or install the driver(Y/N):"))
                while put.upper() != "Y" and put.upper() != "N" and put.upper() != "YES" and put.upper() != "NO":
                    put = raw_input(_("Input error, please re-enter(Y/N):"))
                    print put.upper()

                if put.upper() == "Y" or put.upper() == "YES":

                    status, output = None, None
                    if not os.environ.get("DISPLAY"):
                        cmd = "sudo yget --install -y %s" % did["package"][0]
                        (status, output) = commands.getstatusoutput(cmd)
                        if status:
                            print _("Install failed:%s") % str(output)
                        else:
                            print str(output)
                    else:
                        """set timeout is 600s, the default is 25s"""
                        iface.install(did["package"][0], environ(), timeout=600)

        iface.quit_loop()
        if not flag:
            print _("No proprietary drivers are in use on this system.")