update python2 to python3

This commit is contained in:
smiley286 2018-01-04 09:55:16 +08:00
parent fb42218642
commit 66ec917f29
63 changed files with 294 additions and 426 deletions

View File

@ -1,7 +1,7 @@
TEMPLATE = aux TEMPLATE = aux
inst1.files += ../backends/kylin-assistant-daemon/src/ inst1.files += ../backends/kylin-assistant-daemon/src/
inst1.path = /usr/lib/python2.7/dist-packages/kylin-assistant-daemon/ inst1.path = /usr/lib/python3/dist-packages/kylin-assistant-daemon/
inst2.files += ../backends/kylin-assistant-daemon/data/beautify/autostart/ inst2.files += ../backends/kylin-assistant-daemon/data/beautify/autostart/
inst2.path = /var/lib/kylin-assistant-daemon/ inst2.path = /var/lib/kylin-assistant-daemon/
inst3.files += ../backends/kylin-assistant-daemon/data/beautify/plymouth/ inst3.files += ../backends/kylin-assistant-daemon/data/beautify/plymouth/

View File

@ -1 +1 @@
#!/usr/bin/python #!/usr/bin/python3

View File

@ -1 +1 @@
#!/usr/bin/python #!/usr/bin/python3

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
@ -124,7 +124,7 @@ if __name__ == "__main__":
# print mmm.get_used_memory("g") # print mmm.get_used_memory("g")
# print mmm.get_total_memory("g") # print mmm.get_total_memory("g")
# mmm.ttestt() # mmm.ttestt()
print mmm.get_memory_percent() print(mmm.get_memory_percent())
print mmm.get_total_memory() print(mmm.get_total_memory())
print mmm.get_used_memory() print(mmm.get_used_memory())
print mmm.get_free_memory() print(mmm.get_free_memory())

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
@ -18,7 +18,7 @@
import os import os
import ConfigParser import configparser
import copy import copy
import shutil import shutil
from pprint import pprint from pprint import pprint
@ -31,10 +31,10 @@ OPTION_O = 'OnlyShowIn'
OPTION_NOT = 'NotShowIn' OPTION_NOT = 'NotShowIn'
OPTION_X = 'X-GNOME-Autostart-enabled' OPTION_X = 'X-GNOME-Autostart-enabled'
class MyConfigParser(ConfigParser.ConfigParser): class MyConfigParser(configparser.ConfigParser):
def __inin__(self, defaults=None): def __inin__(self, defaults=None):
ConfigParser.ConfigParser.__init__(self, defaults=None) configparser.ConfigParser.__init__(self, defaults=None)
def optionxform(self, optionstr): def optionxform(self, optionstr):
return optionstr return optionstr
@ -175,7 +175,7 @@ class Desktop_Autostart_Manage():
notautostart_1_list = self.dic.get('notautostart', []) notautostart_1_list = self.dic.get('notautostart', [])
if notautostart_1_list: if notautostart_1_list:
#backup_list = copy.deepcopy(notautostart_list) #backup_list = copy.deepcopy(notautostart_list)
new_notautostart_list = filter(lambda x: not x.count(single.split("/")[-1]), notautostart_1_list) new_notautostart_list = [x for x in notautostart_1_list if not x.count(single.split("/")[-1])]
self.dic['notautostart'] = new_notautostart_list self.dic['notautostart'] = new_notautostart_list
self.dic.setdefault(OPTION_H, []).append(single) self.dic.setdefault(OPTION_H, []).append(single)
@ -187,7 +187,7 @@ class Desktop_Autostart_Manage():
notautostart_2_list = self.dic.get('notautostart', []) notautostart_2_list = self.dic.get('notautostart', [])
if notautostart_2_list: if notautostart_2_list:
#backup_list = copy.deepcopy(notautostart_list) #backup_list = copy.deepcopy(notautostart_list)
new_notautostart_2_list = filter(lambda x: not x.count(single.split("/")[-1]), notautostart_2_list) new_notautostart_2_list = [x for x in notautostart_2_list if not x.count(single.split("/")[-1])]
self.dic['notautostart'] = new_notautostart_2_list self.dic['notautostart'] = new_notautostart_2_list
self.dic.setdefault('autostart', []).append(single) self.dic.setdefault('autostart', []).append(single)
@ -199,7 +199,7 @@ class Desktop_Autostart_Manage():
notautostart_3_list = self.dic.get('notautostart', []) notautostart_3_list = self.dic.get('notautostart', [])
if notautostart_3_list: if notautostart_3_list:
#backup_list = copy.deepcopy(notautostart_list) #backup_list = copy.deepcopy(notautostart_list)
new_notautostart_3_list = filter(lambda x: not x.count(single.split("/")[-1]), notautostart_3_list) new_notautostart_3_list = [x for x in notautostart_3_list if not x.count(single.split("/")[-1])]
self.dic['notautostart'] = new_notautostart_3_list self.dic['notautostart'] = new_notautostart_3_list
self.dic.setdefault('notautostart', []).append(single) self.dic.setdefault('notautostart', []).append(single)
@ -344,7 +344,7 @@ def interface_get_status(fobj):
down_list.append('Status:' + 'false') down_list.append('Status:' + 'false')
fobj.autostartmanage_data_signal(down_list) fobj.autostartmanage_data_signal(down_list)
except Exception, e: except Exception as e:
fobj.autostartmanage_error_signal(str(e)) fobj.autostartmanage_error_signal(str(e))
else: else:
fobj.autostartmanage_status_signal("complete") fobj.autostartmanage_status_signal("complete")
@ -363,7 +363,7 @@ def interface_change_status(fobj, filename):
try: try:
obj = Desktop_Autostart_Manage() obj = Desktop_Autostart_Manage()
obj.change_single_status(filename) obj.change_single_status(filename)
except Exception, e: except Exception as e:
fobj.autostartmanage_error_signal(str(e)) fobj.autostartmanage_error_signal(str(e))
# else: # else:
# fobj.autostartmanage_status_signal("complete") # fobj.autostartmanage_status_signal("complete")

View File

@ -1 +1 @@
#!/usr/bin/python #!/usr/bin/python3

View File

@ -22,8 +22,8 @@
from gi.repository import Gtk from gi.repository import Gtk
from Constants import * from .Constants import *
from Utils import * from .Utils import *
import locale import locale
import gettext import gettext
@ -225,7 +225,7 @@ class FeatureRequirement(Conflict):
self.Feature = feature self.Feature = feature
self.Found = False self.Found = False
for plugin in context.Plugins.values(): for plugin in list(context.Plugins.values()):
if feature in plugin.Features: if feature in plugin.Features:
self.Found = True self.Found = True
if not plugin.Enabled: if not plugin.Enabled:

View File

@ -25,7 +25,7 @@ import weakref
from gi.repository import GObject, Gtk, Gdk, Pango from gi.repository import GObject, Gtk, Gdk, Pango
from Constants import * from .Constants import *
from cgi import escape as protect_pango_markup from cgi import escape as protect_pango_markup
import operator import operator
import itertools import itertools
@ -59,7 +59,7 @@ def getDefaultScreen():
return display.get_default_screen().get_number() return display.get_default_screen().get_number()
def protect_markup_dict (dict_): def protect_markup_dict (dict_):
return dict((k, protect_pango_markup (v)) for (k, v) in dict_.items()) return dict((k, protect_pango_markup (v)) for (k, v) in list(dict_.items()))
class Image (Gtk.Image): class Image (Gtk.Image):
@ -173,7 +173,7 @@ class PrettyButton (Gtk.Button):
def update_state_out (self, *args): def update_state_out (self, *args):
state = args[-1] state = args[-1]
self.states[state] = False self.states[state] = False
if True in self.states.values (): if True in list(self.states.values ()):
self.set_state (Gtk.StateType.PRELIGHT) self.set_state (Gtk.StateType.PRELIGHT)
else: else:
self.set_state (Gtk.StateType.NORMAL) self.set_state (Gtk.StateType.NORMAL)
@ -224,7 +224,7 @@ class IdleSettingsParser:
self.Context = context self.Context = context
self.Main = main self.Main = main
self.PluginList = [p for p in self.Context.Plugins.items() if FilterPlugin(p[1])] self.PluginList = [p for p in list(self.Context.Plugins.items()) if FilterPlugin(p[1])]
nCategories = len (main.MainPage.RightWidget._boxes) nCategories = len (main.MainPage.RightWidget._boxes)
self.CategoryLoadIconsList = list(range(3, nCategories)) # Skip the first 3 self.CategoryLoadIconsList = list(range(3, nCategories)) # Skip the first 3
print('Loading icons...') print('Loading icons...')
@ -390,9 +390,9 @@ def GetSettings(group, types=None):
yield setting yield setting
if types: if types:
screen = TypeFilter(iter(group.Screen.values()), types) screen = TypeFilter(iter(list(group.Screen.values())), types)
else: else:
screen = iter(group.Screen.values()) screen = iter(list(group.Screen.values()))
return screen return screen

View File

@ -1,3 +1,3 @@
from Conflicts import * from .Conflicts import *
from Constants import * from .Constants import *
from Utils import * from .Utils import *

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd # Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
@ -15,16 +15,16 @@
# with this program. If not, see <http://www.gnu.org/licenses/>. # with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE ### END LICENSE
import ConfigParser import configparser
import os, sys import os, sys
import threading import threading
import gsettings from . import gsettings
from shutil import copy from shutil import copy
class CloudConfig(threading.Thread): class CloudConfig(threading.Thread):
def __init__(self, sysdaemon): def __init__(self, sysdaemon):
self.sysdaemon = sysdaemon self.sysdaemon = sysdaemon
self.conf = ConfigParser.ConfigParser() self.conf = configparser.ConfigParser()
self.home = os.path.expandvars('$HOME') self.home = os.path.expandvars('$HOME')
self.youker_path = './' self.youker_path = './'
self.kuaipan_path = '' self.kuaipan_path = ''
@ -527,7 +527,7 @@ class CloudConfig(threading.Thread):
# Restore the system configuration # Restore the system configuration
def use_cloud_configuration(self, file_name): def use_cloud_configuration(self, file_name):
print file_name print(file_name)
self.conf.read(file_name) self.conf.read(file_name)
sections = self.conf.sections() sections = self.conf.sections()
for conf_id in sections: for conf_id in sections:
@ -536,7 +536,7 @@ class CloudConfig(threading.Thread):
# Get kuaipan directory address # Get kuaipan directory address
def get_kuaipan_path(self): def get_kuaipan_path(self):
kpconf = ConfigParser.ConfigParser() kpconf = configparser.ConfigParser()
kpconf.read(self.home + '/.config/ubuntukylin/kuaipan4uk.conf') kpconf.read(self.home + '/.config/ubuntukylin/kuaipan4uk.conf')
return kpconf.get('client-info', 'Root') return kpconf.get('client-info', 'Root')

View File

@ -19,7 +19,7 @@
import glob import glob
import logging import logging
import ConfigParser import configparser
from lxml import etree from lxml import etree
@ -62,7 +62,7 @@ class RawConfigSetting(object):
return value return value
def init_configparser(self): def init_configparser(self):
self._configparser = ConfigParser.ConfigParser() self._configparser = configparser.ConfigParser()
self._configparser.read(self._path) self._configparser.read(self._path)
def sections(self): def sections(self):
@ -118,7 +118,7 @@ class Schema(object):
cls.cached_override[section] = {} cls.cached_override[section] = {}
for option in cs.options(section): for option in cs.options(section):
cls.cached_override[section][option] = cs.get_value(section, option) cls.cached_override[section][option] = cs.get_value(section, option)
except Exception, e: except Exception as e:
log.error('Error while parsing override file: %s' % override) log.error('Error while parsing override file: %s' % override)
@classmethod @classmethod
@ -163,7 +163,7 @@ class Schema(object):
@classmethod @classmethod
def parse_value(cls, key_node): def parse_value(cls, key_node):
log.debug("Try to get type for value: %s" % key_node.items()) log.debug("Try to get type for value: %s" % list(key_node.items()))
value = key_node.find('default').text value = key_node.find('default').text
#TODO enum type #TODO enum type

View File

@ -19,7 +19,7 @@
import logging import logging
import ccm from . import ccm
import compizconfig import compizconfig
log = logging.getLogger('CompizSetting') log = logging.getLogger('CompizSetting')
@ -65,8 +65,8 @@ class CompizPlugin:
@classmethod @classmethod
def is_available(cls, name, setting): def is_available(cls, name, setting):
return cls.context.Plugins.has_key(name) and \ return name in cls.context.Plugins and \
cls.context.Plugins[name].Screen.has_key(setting) setting in cls.context.Plugins[name].Screen
def create_setting(self, key, target): def create_setting(self, key, target):
settings = self._plugin.Screen settings = self._plugin.Screen

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
@ -17,7 +17,7 @@
### END LICENSE ### END LICENSE
import os import os
import gsettings from . import gsettings
class Desktop: class Desktop:
desktop = None desktop = None

View File

@ -21,7 +21,7 @@
### END LICENSE ### END LICENSE
import os import os
import gsettings from . import gsettings
class FileManager: class FileManager:

View File

@ -21,7 +21,7 @@
### END LICENSE ### END LICENSE
import os import os
from settings import Settings from .settings import Settings
import types import types
class GeditManager: class GeditManager:
@ -48,16 +48,16 @@ class GeditManager:
# default = off # default = off
# Get: Auto detect text encoding for Simplified Chinese in Gedit # Get: Auto detect text encoding for Simplified Chinese in Gedit
def get_detect_chinese_encoding(self): def get_detect_chinese_encoding(self):
return self.settings.get_value("auto-detected", types.ListType) return self.settings.get_value("auto-detected", list)
# Set: Auto detect text encoding for Simplified Chinese in Gedit # Set: Auto detect text encoding for Simplified Chinese in Gedit
def set_detect_chinese_encoding(self, flag): def set_detect_chinese_encoding(self, flag):
list_on = ['GB18030', 'UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16'] list_on = ['GB18030', 'UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']
list_off = ['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16'] list_off = ['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']
if(flag): if(flag):
self.settings.set_value("auto-detected", types.ListType, list_off) self.settings.set_value("auto-detected", list, list_off)
else: else:
self.settings.set_value("auto-detected", types.ListType, list_on) self.settings.set_value("auto-detected", list, list_on)
# Get Default Value: Auto detect text encoding for Simplified Chinese in Gedit # Get Default Value: Auto detect text encoding for Simplified Chinese in Gedit
@ -89,4 +89,4 @@ if __name__ == '__main__':
#aa = gm.get_default_schema_value("org.gnome.gedit.preferences.encodings", "auto-detected") #aa = gm.get_default_schema_value("org.gnome.gedit.preferences.encodings", "auto-detected")
#print aa #print aa
gm.set_default_schema_value("org.gnome.gedit.preferences.encodings", "auto-detected", types.ListType) gm.set_default_schema_value("org.gnome.gedit.preferences.encodings", "auto-detected", list)

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
@ -17,7 +17,7 @@
### END LICENSE ### END LICENSE
from gi.repository import Gio as gio from gi.repository import Gio as gio
from common import Schema from .common import Schema
import logging import logging
logger=logging.getLogger('kylin-assistant-daemon') logger=logging.getLogger('kylin-assistant-daemon')

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
@ -16,10 +16,15 @@
# with this program. If not, see <http://www.gnu.org/licenses/>. # with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE ### END LICENSE
import sys
sys.path.append('/usr/lib/python3/dist-packages/PIL') ## add by hb for python3
import os import os
import re import re
import shutil import shutil
import Image import Image
# from _pyio import open # from _pyio import open
class Others: class Others:

View File

@ -24,7 +24,7 @@
from gi.repository import Gio as gio from gi.repository import Gio as gio
import os, sys import os, sys
import types import types
from common import Schema from .common import Schema
#http://lazka.github.io/pgi-docs/api/Gio_2.0/classes/Settings.html #http://lazka.github.io/pgi-docs/api/Gio_2.0/classes/Settings.html
@ -44,32 +44,32 @@ class Settings:
try: try:
setting_type = type setting_type = type
get_func = { get_func = {
types.IntType: self.db.get_int, int: self.db.get_int,
types.StringType: self.db.get_string, bytes: self.db.get_string,
types.BooleanType: self.db.get_boolean, bool: self.db.get_boolean,
types.ListType: self.db.get_strv, list: self.db.get_strv,
types.DictType: self.db.get_string, dict: self.db.get_string,
types.NoneType: self.db.get_value, type(None): self.db.get_value,
}[setting_type] }[setting_type]
return get_func(key) return get_func(key)
except Exception as e: except Exception as e:
print e print(e)
return None return None
def set_value(self, key, type, value): def set_value(self, key, type, value):
try: try:
setting_type = type setting_type = type
set_func = { set_func = {
types.IntType: self.db.set_int, int: self.db.set_int,
types.StringType: self.db.set_string, bytes: self.db.set_string,
types.BooleanType: self.db.set_boolean, bool: self.db.set_boolean,
types.ListType: self.db.set_strv, list: self.db.set_strv,
types.DictType: self.db.set_string, dict: self.db.set_string,
types.NoneType: self.db.set_value, type(None): self.db.set_value,
}[setting_type] }[setting_type]
set_func(key, value) set_func(key, value)
except Exception as e: except Exception as e:
print e print(e)
def get_schema_value(self, schema, key): def get_schema_value(self, schema, key):
schema_default = Schema.load_schema(schema, key) schema_default = Schema.load_schema(schema, key)
@ -108,8 +108,8 @@ if __name__ == '__main__':
#print value #print value
default_value = settings.get_schema_value("org.gnome.gedit.preferences.encodings", "auto-detected") default_value = settings.get_schema_value("org.gnome.gedit.preferences.encodings", "auto-detected")
print "default_value->" print("default_value->")
print default_value print(default_value)

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
@ -18,8 +18,8 @@
import os import os
import shutil import shutil
import gsettings from . import gsettings
import utils from . import utils
class Sound: class Sound:
homedir = '' homedir = ''
@ -218,5 +218,5 @@ if __name__ == '__main__':
# sss.set_login_music_enable(False) # sss.set_login_music_enable(False)
# print sss.get_sound_themes() # print sss.get_sound_themes()
# print sss.get_sound_theme() # print sss.get_sound_theme()
print sss.get_sounds() print(sss.get_sounds())
# sss.set_sound_theme('freedesktop') # sss.set_sound_theme('freedesktop')

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
@ -17,7 +17,7 @@
### END LICENSE ### END LICENSE
import os import os
import gsettings from . import gsettings
import platform import platform
from gi.repository import Gio as gio from gi.repository import Gio as gio

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
@ -17,8 +17,8 @@
### END LICENSE ### END LICENSE
import os import os
import gsettings from . import gsettings
import utils from . import utils
class Theme: class Theme:
homedir = '' homedir = ''
@ -173,7 +173,7 @@ class Theme:
fd.write('Inherits=' + theme + '\n') fd.write('Inherits=' + theme + '\n')
fd.close() fd.close()
return True return True
except Exception,e : except Exception as e :
return False return False
# get cursor size # get cursor size
@ -408,9 +408,9 @@ if __name__ == '__main__':
#print bb #print bb
aa = ttt.get_default_schema_value('org.gnome.desktop.interface', 'cursor-size') aa = ttt.get_default_schema_value('org.gnome.desktop.interface', 'cursor-size')
print aa print(aa)
bb = ttt.get_cursor_size() bb = ttt.get_cursor_size()
print bb print(bb)
ttt.set_default_schema_value('org.gnome.desktop.interface', 'cursor-size', 'int') ttt.set_default_schema_value('org.gnome.desktop.interface', 'cursor-size', 'int')
#aa = ttt.get_default_schema_value('org.gnome.desktop.interface', 'font-name') #aa = ttt.get_default_schema_value('org.gnome.desktop.interface', 'font-name')

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
@ -17,8 +17,8 @@
### END LICENSE ### END LICENSE
import os import os
import gsettings from . import gsettings
from compizsettings import CompizSetting #from .compizsettings import CompizSetting
class Unity: class Unity:
'''if compiz: key is icon_size; else if gsettins: key is icon-size''' '''if compiz: key is icon_size; else if gsettins: key is icon-size'''
@ -33,9 +33,9 @@ class Unity:
# ---------------launcher--------------- # ---------------launcher---------------
# -----------------默认值----------------- # -----------------默认值-----------------
# Get Default Value # Get Default Value
def get_default_schema_value(self, name, key): #def get_default_schema_value(self, name, key):
compizsetting = CompizSetting("%s.%s" % (name, key)) # compizsetting = CompizSetting("%s.%s" % (name, key))
return compizsetting.get_schema_value() # return compizsetting.get_schema_value()
# Set Default Value min=32, max=64, step=16, key="unityshell.icon_size" # Set Default Value min=32, max=64, step=16, key="unityshell.icon_size"
#def set_default_schema_value(self, key, name, type, value): #def set_default_schema_value(self, key, name, type, value):
@ -67,7 +67,7 @@ class Unity:
return True return True
else: else:
return None return None
except Exception, e: except Exception as e:
return False return False
# launcher icon size 32-64 # launcher icon size 32-64
@ -83,7 +83,7 @@ class Unity:
return gsettings.get('org.compiz.unityshell', return gsettings.get('org.compiz.unityshell',
'/org/compiz/profiles/unity/plugins/unityshell/', '/org/compiz/profiles/unity/plugins/unityshell/',
'icon-size', 'int') 'icon-size', 'int')
except Exception, e: except Exception as e:
return 0 return 0
# launcher 'show desktop' icon True/False # launcher 'show desktop' icon True/False
@ -125,7 +125,7 @@ class Unity:
return gsettings.get('org.compiz.unityshell', return gsettings.get('org.compiz.unityshell',
'/org/compiz/profiles/unity/plugins/unityshell/', '/org/compiz/profiles/unity/plugins/unityshell/',
'launcher-opacity', 'double') 'launcher-opacity', 'double')
except Exception, e: except Exception as e:
return 0.0 return 0.0
# 'min' : 0.2, # TODO : Check these min max. Most prolly wrong. # 'min' : 0.2, # TODO : Check these min max. Most prolly wrong.
@ -147,7 +147,7 @@ class Unity:
return gsettings.get('org.compiz.unityshell', return gsettings.get('org.compiz.unityshell',
'/org/compiz/profiles/unity/plugins/unityshell/', '/org/compiz/profiles/unity/plugins/unityshell/',
'backlight-mode', 'int') 'backlight-mode', 'int')
except Exception, e: except Exception as e:
return 0 return 0
# 'map' : {0:0,1:1,2:2,3:3,4:4} 0:所有程序1:仅打开的应用程序2:不着色3:边缘着色4:每个工作区交替着色 # 'map' : {0:0,1:1,2:2,3:3,4:4} 0:所有程序1:仅打开的应用程序2:不着色3:边缘着色4:每个工作区交替着色
@ -178,7 +178,7 @@ class Unity:
return gsettings.get('org.compiz.unityshell', return gsettings.get('org.compiz.unityshell',
'/org/compiz/profiles/unity/plugins/unityshell/', '/org/compiz/profiles/unity/plugins/unityshell/',
'dash-blur-experimental', 'int') 'dash-blur-experimental', 'int')
except Exception, e: except Exception as e:
return 0 return 0
# 活动模糊smart: 2 静态模糊static:1 非模糊0 # 活动模糊smart: 2 静态模糊static:1 非模糊0
@ -194,7 +194,7 @@ class Unity:
return gsettings.get('org.compiz.unityshell', return gsettings.get('org.compiz.unityshell',
'/org/compiz/profiles/unity/plugins/unityshell/', '/org/compiz/profiles/unity/plugins/unityshell/',
'panel-opacity', 'double') 'panel-opacity', 'double')
except Exception, e: except Exception as e:
return 0.0 return 0.0
# 'min' : 0.2, # TODO : Check these min max. Most prolly wrong. # 'min' : 0.2, # TODO : Check these min max. Most prolly wrong.
@ -421,7 +421,7 @@ if __name__ == '__main__':
uuu = Unity() uuu = Unity()
# print uuu.get_launcher_icon_colouring() # print uuu.get_launcher_icon_colouring()
# print uuu.set_launcher_icon_colouring(1) # print uuu.set_launcher_icon_colouring(1)
print uuu.get_time_format() print(uuu.get_time_format())
# bb = uuu.get_default_schema_value("unityshell", "icon_size") # bb = uuu.get_default_schema_value("unityshell", "icon_size")
# aa = uuu.get_default_schema_value("unityshell", "launcher_hide_mode") # aa = uuu.get_default_schema_value("unityshell", "launcher_hide_mode")
#aa = uuu.get_default_schema_value('org.gnome.desktop.media-handling', 'automount') #aa = uuu.get_default_schema_value('org.gnome.desktop.media-handling', 'automount')

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE

View File

@ -1 +1 @@
#!/usr/bin/python #!/usr/bin/python3

View File

@ -66,7 +66,7 @@ class Capture(threading.Thread):
if e.type == QUIT or (e.type == KEYDOWN and e.key == K_ESCAPE): if e.type == QUIT or (e.type == KEYDOWN and e.key == K_ESCAPE):
self.cam.stop() self.cam.stop()
pic_name = get_local_format_time() + '.png' pic_name = get_local_format_time() + '.png'
print pic_name print(pic_name)
going = False going = False
if self.cam.query_image(): if self.cam.query_image():
self.snapshot = self.cam.get_image(self.snapshot) self.snapshot = self.cam.get_image(self.snapshot)

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
# Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd # Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd
@ -20,22 +20,22 @@ import sys
import apt import apt
import apt_pkg import apt_pkg
import shutil import shutil
import commands import subprocess
import threading import threading
import ctypes import ctypes
from apt.progress.base import InstallProgress from apt.progress.base import InstallProgress
import time import time
import historyclean from . import historyclean
import cookiesclean from . import cookiesclean
import searchsame from . import searchsame
import diskanalyse from . import diskanalyse
import osslim from . import osslim
import common from . import common
import cacheclean from . import cacheclean
import oldkernel from . import oldkernel
import systemhistory from . import systemhistory
import dashhistory from . import dashhistory
import softwareconfigfile from . import softwareconfigfile
HOMEDIR = '' HOMEDIR = ''
@ -150,7 +150,7 @@ class OneKeyClean():
sysdaemon.status_for_quick_clean('software_center', caches) sysdaemon.status_for_quick_clean('software_center', caches)
objclean.clean_the_file(caches) objclean.clean_the_file(caches)
sysdaemon.status_for_quick_clean('software_center', 'end') sysdaemon.status_for_quick_clean('software_center', 'end')
except Exception, e: except Exception as e:
sysdaemon.clean_error_onekey('ce') sysdaemon.clean_error_onekey('ce')
else: else:
sysdaemon.clean_complete_onekey('c') sysdaemon.clean_complete_onekey('c')
@ -170,7 +170,7 @@ class OneKeyClean():
filepathc = "%s/.config/chromium/Default/History" % homedir filepathc = "%s/.config/chromium/Default/History" % homedir
objca.clean_chromium_all_records(filepathc) objca.clean_chromium_all_records(filepathc)
sysdaemon.status_for_quick_clean('chromiumhistory', 'end') sysdaemon.status_for_quick_clean('chromiumhistory', 'end')
except Exception, e: except Exception as e:
sysdaemon.clean_error_onekey('he') sysdaemon.clean_error_onekey('he')
else: else:
sysdaemon.clean_complete_onekey('h') sysdaemon.clean_complete_onekey('h')
@ -191,7 +191,7 @@ class OneKeyClean():
pamcc = [filepathcc, 'cookies', 'host_key'] pamcc = [filepathcc, 'cookies', 'host_key']
objcc.clean_all_records(pamcc[0], pamcc[1], pamcc[2]) objcc.clean_all_records(pamcc[0], pamcc[1], pamcc[2])
sysdaemon.status_for_quick_clean('chromiumcookies', 'end') sysdaemon.status_for_quick_clean('chromiumcookies', 'end')
except Exception, e: except Exception as e:
sysdaemon.clean_error_onekey('ke') sysdaemon.clean_error_onekey('ke')
else: else:
sysdaemon.clean_complete_onekey('k') sysdaemon.clean_complete_onekey('k')
@ -602,7 +602,7 @@ def cancel_mainpage_function(target_tid, exception):
def get_threadid(thread_obj): def get_threadid(thread_obj):
found = False found = False
target_tid = 0 target_tid = 0
for tid, tobj in threading._active.items(): for tid, tobj in list(threading._active.items()):
if tobj is thread_obj: if tobj is thread_obj:
found = True found = True
target_tid = tid target_tid = tid
@ -650,8 +650,8 @@ class MainPage():
thumbnailspath = "%s/.cache/thumbnails" % homedir thumbnailspath = "%s/.cache/thumbnails" % homedir
try: try:
temp_thumbnails_list = cache_obj.public_scan_cache(thumbnailspath) temp_thumbnails_list = cache_obj.public_scan_cache(thumbnailspath)
except Exception, e: except Exception as e:
print e print(e)
if sesdaemon: if sesdaemon:
for one in temp_thumbnails_list: for one in temp_thumbnails_list:
self.cache_dic['thumbnail'].append(one) self.cache_dic['thumbnail'].append(one)
@ -661,7 +661,7 @@ class MainPage():
for one in temp_thumbnails_list: for one in temp_thumbnails_list:
self.cache_dic['thumbnail'].append(one) self.cache_dic['thumbnail'].append(one)
if sesdaemon: if sesdaemon:
for key in self.cache_dic.keys(): for key in list(self.cache_dic.keys()):
if self.cache_dic[key]: if self.cache_dic[key]:
flag = True flag = True
break break
@ -677,7 +677,7 @@ class MainPage():
def clean_cache(self, sysdaemon): def clean_cache(self, sysdaemon):
totalsize = 0 totalsize = 0
self.get_cache(None) self.get_cache(None)
for key in self.cache_dic.keys(): for key in list(self.cache_dic.keys()):
for f in self.cache_dic[key]: for f in self.cache_dic[key]:
totalsize += common.get_size(f) totalsize += common.get_size(f)
if os.path.isdir(f): if os.path.isdir(f):

View File

@ -1,6 +1,6 @@
import os import os
from common import get_dir_size from .common import get_dir_size
from common import confirm_filesize_unit from .common import confirm_filesize_unit
class CacheClean(): class CacheClean():

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
# Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd # Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd
@ -16,7 +16,7 @@
### END LICENSE ### END LICENSE
import os import os
import ConfigParser import configparser
import apt import apt
import apt_pkg import apt_pkg
import psutil import psutil
@ -37,7 +37,7 @@ def confirm_filesize_unit(size):
return finalsize return finalsize
def get_dir_size(path): def get_dir_size(path):
size = 0L size = 0
for root, dirs, files in os.walk(path): for root, dirs, files in os.walk(path):
size += sum([os.path.getsize(os.path.join(root, name)) for name in files]) size += sum([os.path.getsize(os.path.join(root, name)) for name in files])
return size return size
@ -81,7 +81,7 @@ def analytical_profiles_file(homedir):
app_path = '%s/.mozilla/firefox' % homedir app_path = '%s/.mozilla/firefox' % homedir
profiles_path = '%s/profiles.ini' % app_path profiles_path = '%s/profiles.ini' % app_path
if os.path.exists(profiles_path): if os.path.exists(profiles_path):
cfg = ConfigParser.ConfigParser() cfg = configparser.ConfigParser()
cfg.read(profiles_path) cfg.read(profiles_path)
complete_section = cfg.sections() complete_section = cfg.sections()
for section in complete_section: for section in complete_section:
@ -90,7 +90,7 @@ def analytical_profiles_file(homedir):
complete_option = cfg.options(section) complete_option = cfg.options(section)
try: try:
cfg.getint(section, 'Default') == 1 cfg.getint(section, 'Default') == 1
except Exception, e: except Exception as e:
pass pass
else: else:
flag_pro_section = section flag_pro_section = section
@ -124,7 +124,7 @@ def get_mozilla_path(homedir):
profiles_path = '%s/profiles.ini' % app_path profiles_path = '%s/profiles.ini' % app_path
if os.path.exists(profiles_path): if os.path.exists(profiles_path):
cfg = ConfigParser.ConfigParser() cfg = configparser.ConfigParser()
cfg.read(profiles_path) cfg.read(profiles_path)
complete_section = cfg.sections() complete_section = cfg.sections()
for section in complete_section: for section in complete_section:
@ -133,7 +133,7 @@ def get_mozilla_path(homedir):
complete_option = cfg.options(section) complete_option = cfg.options(section)
try: try:
cfg.getint(section, 'Default') == 1 cfg.getint(section, 'Default') == 1
except Exception, e: except Exception as e:
pass pass
else: else:
flag_pro_section = section flag_pro_section = section
@ -156,4 +156,4 @@ def get_mozilla_path(homedir):
return finalpath return finalpath
if __name__ == '__main__': if __name__ == '__main__':
print analytical_profiles_file('/home/aya') print(analytical_profiles_file('/home/aya'))

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
# Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd # Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd
@ -18,7 +18,7 @@
import os.path import os.path
import sqlite3 import sqlite3
from common import get_mozilla_path from .common import get_mozilla_path
class CookiesClean(): class CookiesClean():

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
# Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd # Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd
@ -16,7 +16,7 @@
### END LICENSE ### END LICENSE
import os import os
import commands import subprocess
import sqlite3 import sqlite3
@ -48,7 +48,7 @@ class DashHistory():
user = tmp_path.split('/')[2] user = tmp_path.split('/')[2]
os.remove(tmp_path) os.remove(tmp_path)
cmd = "su - %s -c 'zeitgeist-daemon --replace & >& /dev/null'" % user cmd = "su - %s -c 'zeitgeist-daemon --replace & >& /dev/null'" % user
(status, output) = commands.getstatusoutput(cmd) (status, output) = subprocess.getstatusoutput(cmd)
return return

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
# Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd # Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd
@ -18,7 +18,7 @@
import os import os
import os.path import os.path
import common from . import common
class DiskAnalyse(): class DiskAnalyse():
def __init__(self): def __init__(self):

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
# Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd # Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd
@ -17,8 +17,8 @@
import os.path import os.path
import sqlite3 import sqlite3
from common import process_pid from .common import process_pid
from common import get_mozilla_path from .common import get_mozilla_path
class HistoryClean(): class HistoryClean():
@ -37,7 +37,7 @@ class HistoryClean():
tmp = list(eachvisit) tmp = list(eachvisit)
tmp[0], tmp[-1] = str(tmp[0]), str(tmp[-1]) tmp[0], tmp[-1] = str(tmp[0]), str(tmp[-1])
if not isinstance(tmp[2], unicode): if not isinstance(tmp[2], str):
tmp[2] = str(tmp[2]) tmp[2] = str(tmp[2])
tmp_str = '<2_2>'.join(tmp) tmp_str = '<2_2>'.join(tmp)
save.append(tmp_str) save.append(tmp_str)

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
# Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd # Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd
@ -20,7 +20,7 @@ import os
import apt_pkg import apt_pkg
import re import re
import common from . import common
class OldKernel(): class OldKernel():
def __init__(self): def __init__(self):
@ -65,5 +65,5 @@ if __name__ == "__main__":
objo = OldKernel() objo = OldKernel()
#objo.get_the_kernel() #objo.get_the_kernel()
aaa = objo.get_old_kernel() aaa = objo.get_old_kernel()
print aaa print(aaa)

View File

@ -3,7 +3,7 @@ import apt
import apt_pkg import apt_pkg
from apt.progress.base import InstallProgress from apt.progress.base import InstallProgress
import common from . import common
class OsSlim(): class OsSlim():
def __init__(self): def __init__(self):

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
# Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd # Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd
@ -50,7 +50,7 @@ class SearchSame():
def search_by_size(self): def search_by_size(self):
self.style_dic = self.reduce_the_dic(self.tmp_style_dic) self.style_dic = self.reduce_the_dic(self.tmp_style_dic)
size_dic = {} size_dic = {}
for k in self.style_dic.keys(): for k in list(self.style_dic.keys()):
for abc in self.style_dic[k]: for abc in self.style_dic[k]:
filesize = os.path.getsize(abc) filesize = os.path.getsize(abc)
size_dic.setdefault(filesize, []).append(abc) size_dic.setdefault(filesize, []).append(abc)
@ -59,7 +59,7 @@ class SearchSame():
def search_by_cmp(self): def search_by_cmp(self):
final_dic = {} final_dic = {}
size_dic = self.search_by_size() size_dic = self.search_by_size()
for k in size_dic.keys(): for k in list(size_dic.keys()):
for content in size_dic[k]: for content in size_dic[k]:
sha1sumva = self.get_file_hash(content) sha1sumva = self.get_file_hash(content)
final_dic.setdefault(sha1sumva, []).append(content) final_dic.setdefault(sha1sumva, []).append(content)
@ -76,7 +76,7 @@ class SearchSame():
def adjust_the_dic(self): def adjust_the_dic(self):
final_list = [] final_list = []
final_dic = self.search_by_cmp() final_dic = self.search_by_cmp()
for key in final_dic.keys(): for key in list(final_dic.keys()):
tmp_str = "<2_2>".join(final_dic[key]) tmp_str = "<2_2>".join(final_dic[key])
final_list.append(tmp_str) final_list.append(tmp_str)
# init # init
@ -85,7 +85,7 @@ class SearchSame():
return final_list return final_list
def reduce_the_dic(self, tmp_dic): def reduce_the_dic(self, tmp_dic):
for key in tmp_dic.keys(): for key in list(tmp_dic.keys()):
if len(tmp_dic[key]) < 2: if len(tmp_dic[key]) < 2:
del tmp_dic[key] del tmp_dic[key]
return tmp_dic return tmp_dic

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
# Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd # Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd
@ -15,9 +15,9 @@
# with this program. If not, see <http://www.gnu.org/licenses/>. # with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE ### END LICENSE
import commands import subprocess
import common from . import common
class SoftwareConfigfile(): class SoftwareConfigfile():
def __init__(self): def __init__(self):
@ -27,7 +27,7 @@ class SoftwareConfigfile():
cache = common.get_cache_list() cache = common.get_cache_list()
final_softwareconfigfile_list = [] final_softwareconfigfile_list = []
status, output = commands.getstatusoutput('dpkg -l') status, output = subprocess.getstatusoutput('dpkg -l')
result = [(line.split()[1]).split(':')[0] for line in output.split('\n') if line.startswith('rc')] result = [(line.split()[1]).split(':')[0] for line in output.split('\n') if line.startswith('rc')]
for one in result: for one in result:
final_softwareconfigfile_list.append(cache[one]) final_softwareconfigfile_list.append(cache[one])
@ -36,7 +36,7 @@ class SoftwareConfigfile():
cache = common.get_cache_list() cache = common.get_cache_list()
softwareconfigfile_list = [] softwareconfigfile_list = []
status, output = commands.getstatusoutput('dpkg -l') status, output = subprocess.getstatusoutput('dpkg -l')
result = [(line.split()[1]).split(':')[0] for line in output.split('\n') if line.startswith('rc')] result = [(line.split()[1]).split(':')[0] for line in output.split('\n') if line.startswith('rc')]
for one in result: for one in result:
pkg = cache[one] pkg = cache[one]
@ -47,4 +47,4 @@ class SoftwareConfigfile():
if __name__ == '__main__': if __name__ == '__main__':
obj = SoftwareConfigfile() obj = SoftwareConfigfile()
a = obj.scan_configfile_packages() a = obj.scan_configfile_packages()
print a print(a)

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
# Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd # Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd

View File

@ -1 +1 @@
#!/usr/bin/python #!/usr/bin/python3

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
# Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd # Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd
@ -26,7 +26,7 @@ import struct
import math import math
import binascii import binascii
import platform import platform
import commands import subprocess
import random import random
from pprint import pprint from pprint import pprint
@ -256,7 +256,7 @@ class DetailInfo:
# print platform.uname() # print platform.uname()
def ctoascii(self,buf): def ctoascii(self,buf):
ch = str(buf) ch = bytes(buf.encode('utf-8'))
asci = binascii.b2a_hex(ch) asci = binascii.b2a_hex(ch)
asci = int(asci,16) asci = int(asci,16)
return asci return asci
@ -272,7 +272,7 @@ class DetailInfo:
k = len(s) k = len(s)
i = 0 i = 0
while i < len(s): while i < len(s):
if s[i] < 32: if self.ctoascii(s[i]) < 32:
s = s[ :i] + s[i+1: ] s = s[ :i] + s[i+1: ]
i -= 1 i -= 1
i += 1 i += 1
@ -703,10 +703,10 @@ class DetailInfo:
cpu_siblings = line.rstrip('\n').split(':')[1] cpu_siblings = line.rstrip('\n').split(':')[1]
elif line.rstrip('\n').startswith('clflush size'): elif line.rstrip('\n').startswith('clflush size'):
clflush_size = line.rstrip('\n').split(':')[1] clflush_size = line.rstrip('\n').split(':')[1]
clflush_size = filter(str.isdigit,clflush_size) clflush_size = list(filter(str.isdigit,clflush_size))
elif line.rstrip('\n').startswith('cache size'): elif line.rstrip('\n').startswith('cache size'):
cache_size = line.rstrip('\n').split(':')[1] cache_size = line.rstrip('\n').split(':')[1]
cache_size = filter(str.isdigit,cache_size) cache_size = list(filter(str.isdigit,cache_size))
Cpu['cpu_cores'],Cpu['cpu_siblings'],Cpu['clflush_size'],Cpu['cache_size'] = cpu_cores,cpu_siblings,clflush_size,cache_size Cpu['cpu_cores'],Cpu['cpu_siblings'],Cpu['clflush_size'],Cpu['cache_size'] = cpu_cores,cpu_siblings,clflush_size,cache_size
return Cpu return Cpu
@ -924,7 +924,6 @@ class DetailInfo:
p = re.compile(r'Output %s connected' % monitor) p = re.compile(r'Output %s connected' % monitor)
for m in p.finditer(info): # p.finditer(info) 返回一个迭代对象,通常只会循环一次 for m in p.finditer(info): # p.finditer(info) 返回一个迭代对象,通常只会循环一次
Vga_num += 1 Vga_num += 1
print(monitor)
#print info.split("EDID for output %s" % monitor)[1].split("EDID for output")[0] #print info.split("EDID for output %s" % monitor)[1].split("EDID for output")[0]
#ret.setdefault("Mon_output", monitor) #ret.setdefault("Mon_output", monitor)
ret_output += (monitor + "<1_1>") ret_output += (monitor + "<1_1>")
@ -964,7 +963,7 @@ class DetailInfo:
Vga_businfo += "<1_1>"; Vga_product += "<1_1>"; Vga_vendor += "<1_1>"; Vga_Drive += "<1_1>" Vga_businfo += "<1_1>"; Vga_product += "<1_1>"; Vga_vendor += "<1_1>"; Vga_Drive += "<1_1>"
status, output = commands.getstatusoutput('lspci -vvv') status, output = subprocess.getstatusoutput('lspci -vvv')
if not status: if not status:
for local in output.split("\n\n"): for local in output.split("\n\n"):
if "VGA compatible controller: " in local: if "VGA compatible controller: " in local:
@ -976,7 +975,7 @@ class DetailInfo:
for line in local.split("\n"): for line in local.split("\n"):
if "VGA compatible controller: " in line: if "VGA compatible controller: " in line:
print line print(line)
Vga_product += line.split(":")[2][:-30] Vga_product += line.split(":")[2][:-30]
Vga_vendor += self.get_url("", line.split(":")[2]) Vga_vendor += self.get_url("", line.split(":")[2])
if "Kernel driver in use: " in line: if "Kernel driver in use: " in line:
@ -990,131 +989,6 @@ class DetailInfo:
ret["Vga_num"], ret['Vga_businfo'],ret['Vga_product'],ret['Vga_vendor'],ret['Vga_Drive'] = self.strip(str(Vga_num)), self.strip(Vga_businfo),self.strip(Vga_product),self.strip(Vga_vendor),self.strip(Vga_Drive) ret["Vga_num"], ret['Vga_businfo'],ret['Vga_product'],ret['Vga_vendor'],ret['Vga_Drive'] = self.strip(str(Vga_num)), self.strip(Vga_businfo),self.strip(Vga_product),self.strip(Vga_vendor),self.strip(Vga_Drive)
return ret return ret
def get_monitor_obsolete(self):
#Monitor
# ret = {'Mon_chip': 'CAICOS',
# 'Mon_gamma': '2.20',
# 'Mon_in': '24.1',
# 'Mon_maxmode': '1920x1200',
# 'Mon_output': 'HDMI-0',
# 'Mon_product': 'DELL U2413',
# 'Mon_size': '51.8cm x 32.4cm',
# 'Mon_support': "['HDMI-0', 'VGA-0']",
# 'Mon_vendor': 'DELL',
# 'Mon_week': '13',
# 'Mon_year': '2015',
# 'Vga_Drive': 'radeon',
# 'Vga_businfo': 'pci@0000:02:00.0',
# 'Vga_num': '1',
# 'Vga_product': 'Advanced Micro Devices, Inc. [AMD/ATI] Caicos XT [Radeon HD 7470/8470 / R5 235/310 OEM] (prog-if 00 [VGA controller])',
# 'Vga_vendor': 'ATI'}
# return ret
ret = {}
with open('/var/log/Xorg.0.log','r') as fp:
info = fp.read()
tmp = re.findall('Monitor name: \s*(\w*)\s*(\w*)', info)
if tmp:
if tmp[0][1]:
ret["Mon_vendor"] = tmp[0][0]
ret["Mon_product"] = tmp[0][0] + " " + tmp[0][1]
else:ret["Mon_product"] = tmp[0][0]
tmp = re.findall("Manufacturer:\s*(\w*)\s*Model:\s*(\w*)", info)
if tmp:
if not ret.get("Mon_product"):
ret["Mon_product"] = tmp[0][0] + " " + tmp[0][1]
if not ret.get("Mon_vendor"):
ret["Mon_vendor"] = tmp[0][0]
tmp = re.findall("Year:\s*(\w*)\s*Week:\s*(\w*)", info)
if tmp:
ret["Mon_year"] = tmp[0][0]
ret["Mon_week"] = tmp[0][1]
tmp = re.findall("Image Size: \s*(\w*) x (\w*)", info)
if tmp:
x = float(tmp[0][0])/10
y = float(tmp[0][1])/10
d = math.sqrt(x**2 + y**2)/2.54
ret["Mon_size"] = str(x) + "cm" + " x " + str(y) + "cm"
ret["Mon_in"] = "%.1f" %d
tmp = re.findall("Gamma: (\S*)", info)
if tmp:
ret["Mon_gamma"] = tmp[0]
h = re.findall("h_active: (\d*)", info)
v = re.findall("v_active: (\d*)", info)
if h and v:
ret["Mon_maxmode"] = h[0] + "x" + v[0]
tmp = re.findall("EDID for output (.*)", info)
if tmp:
ret["Mon_support"] = str(tmp)
tmp = re.findall("Output (.*).* connected", info)
if tmp:
ret["Mon_output"] = tmp[0]
tmp = re.findall("Integrated Graphics Chipset: (.*)", info)
if tmp:
ret["Mon_chip"] = tmp[0]
tmp = re.findall("Chipset: \"(.*)\"", info)
if tmp:
if not ret.get("Mon_chip"):
ret["Mon_chip"] = tmp[0]
n = os.popen('lspci -vvv')
vga = n.read()
n.close()
Vga_num = 0
Vga_product,Vga_vendor,Vga_businfo,Vga_Drive = '','','',''
if vga :
while re.findall('VGA compatible controller: ',vga) :
tmp = vga[vga.index('VGA compatible controller: ') - 8:]
vga = tmp[30:]
if tmp[:8]:
median = 'pci@0000:' + tmp[:8]
else:
median = '$'
if Vga_businfo:
Vga_businfo += "<1_1>" + median
else:
Vga_businfo = median
pro = re.findall('VGA compatible controller: (.*)',tmp)
if pro:
median = pro[0]
median_2 = self.get_url('',pro[0])
else:
median = '$'
median_2 = '$'
if Vga_product:
Vga_product += "<1_1>" + median
Vga_vendor += "<1_1>" + median_2
else:
Vga_product = median
Vga_vendor = median_2
Vga_num += 1
tmp = re.findall('Kernel driver in use: (.*)',tmp)
if tmp:
median = tmp[0]
else:
median = '$'
if Vga_Drive:
Vga_Drive += "<1_1>" + median
else :
Vga_Drive = median
if (ret.get('Mon_vendor')):
if (ret.get('Mon_product')):
ret['Mon_vendor'] = self.get_url(ret['Mon_vendor'],ret['Mon_product'])
else :
ret['Mon_vendor'] = self.get_url(ret['Mon_vendor'],'')
ret['Vga_num'],ret['Vga_businfo'],ret['Vga_product'],ret['Vga_vendor'],ret['Vga_Drive'] = self.strip(str(Vga_num)),self.strip(Vga_businfo),self.strip(Vga_product),self.strip(Vga_vendor),self.strip(Vga_Drive)
return ret
def get_disk_obsolete(self): def get_disk_obsolete(self):
dis={} dis={}
disknum = 0 disknum = 0
@ -1210,7 +1084,7 @@ class DetailInfo:
### add by hebing at 2017.01.20 ### add by hebing at 2017.01.20
### NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT ### NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
disklist = [] disklist = []
status, output = commands.getstatusoutput("lsblk -ab") status, output = subprocess.getstatusoutput("lsblk -ab")
for line in output.split("\n"): for line in output.split("\n"):
value = line.split() value = line.split()
if value[1] == "8:0" and value[5] == "disk": if value[1] == "8:0" and value[5] == "disk":
@ -1255,7 +1129,7 @@ class DetailInfo:
DiskProduct,DiskVendor,DiskCapacity,DiskName,DiskFw,DiskSerial = '','','','','','' DiskProduct,DiskVendor,DiskCapacity,DiskName,DiskFw,DiskSerial = '','','','','',''
diskdict = {} diskdict = {}
disknum = 0 disknum = 0
statusfirst, output = commands.getstatusoutput("lsblk -b") statusfirst, output = subprocess.getstatusoutput("lsblk -b")
for line in output.split("\n"): for line in output.split("\n"):
value = line.split() value = line.split()
@ -1266,21 +1140,18 @@ class DetailInfo:
# DiskCapacity += ( ((str(int(value[3]) / 10**9) + "G") if not statusfirst else "$") + "<1_1>") # DiskCapacity += ( ((str(int(value[3]) / 10**9) + "G") if not statusfirst else "$") + "<1_1>")
infodict = {} infodict = {}
status, output = commands.getstatusoutput("hdparm -i %s" % ("/dev/" + value[0])) status, output = subprocess.getstatusoutput("hdparm -i %s" % ("/dev/" + value[0]))
pprint(status)
if not status: if not status:
singleinfolist = [ tmp.strip() for tmp in output.split("\n") if tmp] singleinfolist = [ tmp.strip() for tmp in output.split("\n") if tmp]
pprint(output)
for mid in singleinfolist[1].split(","): for mid in singleinfolist[1].split(","):
needinfo = mid.split("=") needinfo = mid.split("=")
infodict.setdefault(needinfo[0].strip(), needinfo[1]) infodict.setdefault(needinfo[0].strip(), needinfo[1])
for key, va in disk_manufacturers.items(): for key, va in list(disk_manufacturers.items()):
if infodict.get("Model", "$").startswith(key): if infodict.get("Model", "$").startswith(key):
infodict.setdefault("Vendor", va) infodict.setdefault("Vendor", va)
break break
pprint(infodict)
DiskProduct += (infodict.get("Model", "$") + "<1_1>") DiskProduct += (infodict.get("Model", "$") + "<1_1>")
DiskVendor += (infodict.get("Vendor", "$") + "<1_1>") DiskVendor += (infodict.get("Vendor", "$") + "<1_1>")
DiskFw += (infodict.get("FwRev", "$") + "<1_1>") DiskFw += (infodict.get("FwRev", "$") + "<1_1>")
@ -1292,12 +1163,6 @@ class DetailInfo:
DiskFw += ("$" + "<1_1>") DiskFw += ("$" + "<1_1>")
DiskSerial += ("$" + "<1_1>") DiskSerial += ("$" + "<1_1>")
DiskName += (("/dev/" + value[0]) + "<1_1>") DiskName += (("/dev/" + value[0]) + "<1_1>")
pprint(DiskProduct)
pprint(DiskVendor)
pprint(DiskFw)
pprint(DiskSerial)
pprint(DiskName)
pprint(DiskCapacity)
dis['DiskNum'],dis['DiskProduct'],dis['DiskVendor'],dis['DiskCapacity'],dis['DiskName'],dis['DiskFw'],dis['DiskSerial'] = str(disknum),DiskProduct.rstrip("<1_1>"),DiskVendor.rstrip("<1_1>"),DiskCapacity.rstrip("<1_1>"),DiskName.rstrip("<1_1>"),DiskFw.rstrip("<1_1>"),DiskSerial.rstrip("<1_1>") dis['DiskNum'],dis['DiskProduct'],dis['DiskVendor'],dis['DiskCapacity'],dis['DiskName'],dis['DiskFw'],dis['DiskSerial'] = str(disknum),DiskProduct.rstrip("<1_1>"),DiskVendor.rstrip("<1_1>"),DiskCapacity.rstrip("<1_1>"),DiskName.rstrip("<1_1>"),DiskFw.rstrip("<1_1>"),DiskSerial.rstrip("<1_1>")
return dis return dis
@ -1663,8 +1528,8 @@ class DetailInfo:
tmp = re.findall('capabilities: (\d*)',network) tmp = re.findall('capabilities: (\d*)',network)
if tmp: if tmp:
NetCapacity = tmp[0] NetCapacity = tmp[0]
except Exception, e: except Exception as e:
print e print(e)
WlanProduct,WlanVendor,WlanBusinfo,WlanLogicalname,WlanSerial,WlanIp,WlanDrive = '','','','','','','' WlanProduct,WlanVendor,WlanBusinfo,WlanLogicalname,WlanSerial,WlanIp,WlanDrive = '','','','','','',''
n = os.popen('lspci -vvv') n = os.popen('lspci -vvv')
wlan = n.read() wlan = n.read()
@ -1891,16 +1756,16 @@ class DetailInfo:
"in19": 12, "in19": 12,
} }
status, output = commands.getstatusoutput("sensors") status, output = subprocess.getstatusoutput("sensors")
for line in output.split("\n"): for line in output.split("\n"):
for key in opposite.items(): for key in list(opposite.items()):
if line.split(":")[0] == key[1]: if line.split(":")[0] == key[1]:
if key[1] in ["in17", "in18", "in19"]: if key[1] in ["in17", "in18", "in19"]:
value = (line.split(":")[1]).split("(")[0].strip() value = (line.split(":")[1]).split("(")[0].strip()
origin[key[0]] = value[0:1] + str(float(value[1:-1]) * product[key[1]]) + " V" origin[key[0]] = value[0:1] + str(float(value[1:-1]) * product[key[1]]) + " V"
break break
if key[1] in ["temp5", "temp6"]: if key[1] in ["temp5", "temp6"]:
origin[key[0]] = ((line.split(":")[1]).split("(")[0].strip())[0:5] + u"" origin[key[0]] = ((line.split(":")[1]).split("(")[0].strip())[0:5] + ""
break break
origin[key[0]] = (line.split(":")[1]).split("(")[0].strip() origin[key[0]] = (line.split(":")[1]).split("(")[0].strip()
break break

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
# Copyright (C) 2007-2011 Tualatrix Chou <tualatrix@gmail.com> # Copyright (C) 2007-2011 Tualatrix Chou <tualatrix@gmail.com>
@ -26,7 +26,7 @@ UKPATH = '/com/kylin/assistant/systemdaemon'
SHOWED = False SHOWED = False
def show_message(*args): def show_message(*args):
from dialogs import ErrorDialog from .dialogs import ErrorDialog
title = 'Daemon start failed' title = 'Daemon start failed'
message = ('Kylin Assisant systemdaemon didn\'t start correctly.\n' message = ('Kylin Assisant systemdaemon didn\'t start correctly.\n'
'If you want to help developers debugging, try to run "<b>sudo /usr/lib/python2.7/dist-packages/kylin-assistant-daemon/src/start_systemdbus.py</b>" in a terminal.') 'If you want to help developers debugging, try to run "<b>sudo /usr/lib/python2.7/dist-packages/kylin-assistant-daemon/src/start_systemdbus.py</b>" in a terminal.')
@ -39,14 +39,14 @@ class DbusProxy:
try: try:
__system_bus = dbus.SystemBus() __system_bus = dbus.SystemBus()
__object = __system_bus.get_object(INTERFACE, UKPATH) __object = __system_bus.get_object(INTERFACE, UKPATH)
except Exception, e: except Exception as e:
__object = None __object = None
def __getattr__(self, name): def __getattr__(self, name):
global SHOWED global SHOWED
try: try:
return self.__object.get_dbus_method(name, dbus_interface=self.INTERFACE) return self.__object.get_dbus_method(name, dbus_interface=self.INTERFACE)
except Exception, e: except Exception as e:
#log.error(e) #log.error(e)
if not SHOWED: if not SHOWED:
SHOWED = True SHOWED = True
@ -68,4 +68,4 @@ def init_dbus(dbus_iface=INTERFACE, dbus_path=UKPATH):
return proxy return proxy
if __name__ == '__main__': if __name__ == '__main__':
print init_dbus() print(init_dbus())

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
@ -16,7 +16,7 @@
# with this program. If not, see <http://www.gnu.org/licenses/>. # with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE ### END LICENSE
import thread import _thread
from gi.repository import GObject, Gtk, Gdk from gi.repository import GObject, Gtk, Gdk

View File

@ -1 +1 @@
#!/usr/bin/python #!/usr/bin/python3

View File

@ -21,11 +21,11 @@
### END LICENSE ### END LICENSE
import os, sys import os, sys
import urllib2 import urllib.request, urllib.error, urllib.parse
import platform import platform
import re import re
import subprocess import subprocess
import commands import subprocess
BOOL_TYPE = 1 BOOL_TYPE = 1
INT_TYPE = 2 INT_TYPE = 2
@ -98,21 +98,21 @@ def get_ip_again():
ret = '' ret = ''
url = "http://members.3322.org/dyndns/getip" url = "http://members.3322.org/dyndns/getip"
try: try:
fp = urllib2.urlopen(url, timeout=5) fp = urllib.request.urlopen(url, timeout=5)
souce = fp.read() souce = fp.read()
if not isinstance(souce, str): if not isinstance(souce, str):
souce = str(souce) souce = str(souce)
fp.close() fp.close()
ret = souce.replace('\n', '') ret = souce.replace('\n', '')
except: except:
print >> sys.stderr, 'get_ip failed!' print('get_ip failed!', file=sys.stderr)
return ret return ret
def get_ip(): def get_ip():
ret = '' ret = ''
url = "http://iframe.ip138.com/ic.asp" url = "http://iframe.ip138.com/ic.asp"
try: try:
fp = urllib2.urlopen(url, timeout=5) fp = urllib.request.urlopen(url, timeout=5)
souce = fp.read().decode("GB2312") souce = fp.read().decode("GB2312")
fp.close() fp.close()
ret = re.findall("<center>(.*)</center>", souce)[0].encode("UTF-8") ret = re.findall("<center>(.*)</center>", souce)[0].encode("UTF-8")
@ -144,10 +144,10 @@ def run_app(pkgname):
def get_output(cmd): def get_output(cmd):
'''status =0 : success''' '''status =0 : success'''
status, output = commands.getstatusoutput(cmd) status, output = subprocess.getstatusoutput(cmd)
if status: raise if status: raise
return output return output
if __name__ == '__main__': if __name__ == '__main__':
ip = get_ip() ip = get_ip()
print ip print(ip)

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
# Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd # Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd
@ -16,8 +16,6 @@
### END LICENSE ### END LICENSE
import sys import sys
reload(sys)
sys.setdefaultencoding('utf8')
import os import os
import glob import glob
import fcntl import fcntl
@ -25,7 +23,6 @@ import shutil
import logging import logging
import tempfile import tempfile
import subprocess import subprocess
import commands
import re import re
from subprocess import PIPE from subprocess import PIPE
import apt import apt
@ -39,8 +36,8 @@ import platform
import cleaner import cleaner
from autostartmanage import autostartmanage from autostartmanage import autostartmanage
#import pywapi #import pywapi
import urllib2, urllib import urllib.request, urllib.error, urllib.parse, urllib.request, urllib.parse, urllib.error
from urllib import urlencode from urllib.parse import urlencode
from xml.dom.minidom import parseString from xml.dom.minidom import parseString
import re import re
import json import json
@ -67,7 +64,7 @@ from sysinfo import Sysinfo
#from camera.capture import Capture #from camera.capture import Capture
#from weather.weatherinfo import WeatherInfo #from weather.weatherinfo import WeatherInfo
#from weather.yahoo import YahooWeather #from weather.yahoo import YahooWeather
from common import * from .common import *
#from unzip import unzip_resource #from unzip import unzip_resource
#from piston_mini_client import APIError #from piston_mini_client import APIError
import httplib2 import httplib2
@ -97,7 +94,7 @@ BATTERY_PATH = "/sys/class/power_supply/BAT0"
BAT_FILE = "/sys/class/power_supply/BAT0/uevent" BAT_FILE = "/sys/class/power_supply/BAT0/uevent"
from gi.repository import Gio as gio from gi.repository import Gio as gio
from common import (BOOL_TYPE, INT_TYPE, DOUBLE_TYPE, STRING_TYPE) from .common import (BOOL_TYPE, INT_TYPE, DOUBLE_TYPE, STRING_TYPE)
#Depends:gir1.2-gconf-2.0 #Depends:gir1.2-gconf-2.0
#from gi.repository import GConf #from gi.repository import GConf
@ -378,7 +375,10 @@ class SessionDaemon(dbus.service.Object):
def currently_installed_version(self): def currently_installed_version(self):
apt_list = [] apt_list = []
cache = apt.Cache() cache = apt.Cache()
try:
pkg = cache['kylin-assistant'] pkg = cache['kylin-assistant']
except KeyError as e:
return [""]
installed_version = pkg.installed.version installed_version = pkg.installed.version
# print installed_version # print installed_version
if ":" in installed_version: if ":" in installed_version:
@ -432,13 +432,13 @@ class SessionDaemon(dbus.service.Object):
@dbus.service.method(INTERFACE, in_signature='d', out_signature='') @dbus.service.method(INTERFACE, in_signature='d', out_signature='')
def adjust_screen_gamma(self, gamma): def adjust_screen_gamma(self, gamma):
cmd = "xgamma -gamma " + str(gamma) cmd = "xgamma -gamma " + str(gamma)
print cmd print(cmd)
os.system(cmd) os.system(cmd)
@dbus.service.method(INTERFACE, in_signature='', out_signature='d') @dbus.service.method(INTERFACE, in_signature='', out_signature='d')
def get_screen_gamma(self): def get_screen_gamma(self):
# p = os.popen("xgamma") # p = os.popen("xgamma")
status, output = commands.getstatusoutput("xgamma") status, output = subprocess.getstatusoutput("xgamma")
gamma_list = output.split(" ") gamma_list = output.split(" ")
gamma = gamma_list[len(gamma_list) - 1] gamma = gamma_list[len(gamma_list) - 1]
return float(gamma) return float(gamma)
@ -547,9 +547,9 @@ class SessionDaemon(dbus.service.Object):
self.sso.find_oauth_token() self.sso.find_oauth_token()
except ImportError: except ImportError:
print('Initial ubuntu-kylin-sso-client failed, seem it is not installed.') print('Initial ubuntu-kylin-sso-client failed, seem it is not installed.')
except Exception, e: except Exception as e:
print('Check user failed.') print('Check user failed.')
print e print(e)
@dbus.service.method(INTERFACE, in_signature='', out_signature='') @dbus.service.method(INTERFACE, in_signature='', out_signature='')
def slot_do_login_account(self): def slot_do_login_account(self):
@ -558,9 +558,9 @@ class SessionDaemon(dbus.service.Object):
self.sso.get_oauth_token() self.sso.get_oauth_token()
except ImportError: except ImportError:
print('Initial ubuntu-kylin-sso-client failed, seem it is not installed.') print('Initial ubuntu-kylin-sso-client failed, seem it is not installed.')
except Exception, e: except Exception as e:
print('User login failed.') print('User login failed.')
print e print(e)
# user register # user register
@dbus.service.method(INTERFACE, in_signature='', out_signature='') @dbus.service.method(INTERFACE, in_signature='', out_signature='')
@ -571,9 +571,9 @@ class SessionDaemon(dbus.service.Object):
except ImportError: except ImportError:
print('Initial ubuntu-kylin-sso-client failed, seem it is not installed.') print('Initial ubuntu-kylin-sso-client failed, seem it is not installed.')
except Exception, e: except Exception as e:
print('User register failed.') print('User register failed.')
print e print(e)
@dbus.service.method(INTERFACE, in_signature='', out_signature='') @dbus.service.method(INTERFACE, in_signature='', out_signature='')
def slot_do_logout(self): def slot_do_logout(self):
@ -582,31 +582,31 @@ class SessionDaemon(dbus.service.Object):
except ImportError: except ImportError:
print('Initial ubuntu-kylin-sso-client failed, seem it is not installed.') print('Initial ubuntu-kylin-sso-client failed, seem it is not installed.')
except Exception, e: except Exception as e:
print('User logout failed.') print('User logout failed.')
print e print(e)
#update user login status #update user login status
def slot_whoami_done(self, sso, result): def slot_whoami_done(self, sso, result):
self.user = result["username"] self.user = result["username"]
self.display_name = result["displayname"] self.display_name = result["displayname"]
self.preferred_email = result["preferred_email"] self.preferred_email = result["preferred_email"]
print 'Login success, username: %s' % self.display_name print('Login success, username: %s' % self.display_name)
self.youkerid_whoami_signal(self.display_name, self.preferred_email) self.youkerid_whoami_signal(self.display_name, self.preferred_email)
def slot_logout_successful(self, sso): def slot_logout_successful(self, sso):
if self.token: if self.token:
print 'User %s has been logout' % self.display_name print('User %s has been logout' % self.display_name)
self.token = '' self.token = ''
self.user = '' self.user = ''
self.display_name = '' self.display_name = ''
self.preferred_email = '' self.preferred_email = ''
else: else:
print 'No user has been login' print('No user has been login')
self.youkerid_logout_signal() self.youkerid_logout_signal()
def slot_login_fail(self, sso): def slot_login_fail(self, sso):
print 'Login or logout failed' print('Login or logout failed')
self.youkerid_login_fail_signal() self.youkerid_login_fail_signal()
@dbus.service.signal(INTERFACE, signature='ss') @dbus.service.signal(INTERFACE, signature='ss')
@ -665,7 +665,7 @@ class SessionDaemon(dbus.service.Object):
os.mknod(distrowatch_path) os.mknod(distrowatch_path)
srcFile = '/var/lib/kylin-assistant-daemon/distrowatch.conf' srcFile = '/var/lib/kylin-assistant-daemon/distrowatch.conf'
if not os.path.exists(srcFile): if not os.path.exists(srcFile):
print "error with distrowatch file" print("error with distrowatch file")
return return
else: else:
open(distrowatch_path, "wb").write(open(srcFile, "rb").read()) open(distrowatch_path, "wb").write(open(srcFile, "rb").read())
@ -883,7 +883,7 @@ class SessionDaemon(dbus.service.Object):
if '=' in eachline: if '=' in eachline:
tmp_list = eachline.split('=') tmp_list = eachline.split('=')
bat_dict[tmp_list[0]] = tmp_list[1] bat_dict[tmp_list[0]] = tmp_list[1]
except Exception, e: except Exception as e:
bat_dict['error'] = 'unknown' bat_dict['error'] = 'unknown'
return bat_dict return bat_dict
@ -2030,10 +2030,10 @@ class SessionDaemon(dbus.service.Object):
for urllist in source_urllist: for urllist in source_urllist:
source_url = '/'.join(urllist) source_url = '/'.join(urllist)
try: try:
response = urllib2.urlopen(source_url,timeout=5) response = urllib.request.urlopen(source_url,timeout=5)
good_source_urllist.append(source_url) good_source_urllist.append(source_url)
except Exception, e: except Exception as e:
print e print(e)
bad_source_urllist.append(source_url) bad_source_urllist.append(source_url)
if good_source_urllist == []: if good_source_urllist == []:
self.check_source_list_signal(False) self.check_source_list_signal(False)

View File

@ -23,9 +23,7 @@ ratings and reviews API, plus a few helper classes.
""" """
import os, sys import os, sys
reload(sys) from urllib.parse import quote_plus
sys.setdefaultencoding('utf8')
from urllib import quote_plus
from piston_mini_client import ( from piston_mini_client import (
PistonAPI, PistonAPI,
PistonResponseObject, PistonResponseObject,

View File

@ -43,10 +43,10 @@ def unzip_resource(package_file):
subprocess.call(["unzip", package_file, "-d", unziped_dir]) subprocess.call(["unzip", package_file, "-d", unziped_dir])
dest_dir = unziped_dir + "uk-img/" dest_dir = unziped_dir + "uk-img/"
if not os.path.exists(dest_dir): if not os.path.exists(dest_dir):
print("unzip '%s' to '%s' failed" % (package_file , unziped_dir)) print(("unzip '%s' to '%s' failed" % (package_file , unziped_dir)))
return False return False
else: else:
print "unzip ok...." print("unzip ok....")
return True return True
# unziped_dir = unziped_dir + WS360_CHROME_PKGNAME # unziped_dir = unziped_dir + WS360_CHROME_PKGNAME
# version = get_package_ver_from_manifest(unziped_dir) # version = get_package_ver_from_manifest(unziped_dir)

View File

@ -1,8 +1,8 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os, sys, shutil, tempfile import os, sys, shutil, tempfile
import commands import subprocess
# ensure that single instance of applet is running for each user # ensure that single instance of applet is running for each user
class SingleInstance(object): class SingleInstance(object):
@ -15,7 +15,7 @@ class SingleInstance(object):
# Make sure it is not a "stale" pidFile # Make sure it is not a "stale" pidFile
pid = open(pidPath, 'r').read().strip() pid = open(pidPath, 'r').read().strip()
# Check list of running pids, if not running it is stale so overwrite # Check list of running pids, if not running it is stale so overwrite
pidRunning = commands.getoutput('ls -1 /proc | grep ^%s$' % pid) pidRunning = subprocess.getoutput('ls -1 /proc | grep ^%s$' % pid)
self.lasterror = True if pidRunning else False self.lasterror = True if pidRunning else False
else: else:
self.lasterror = False self.lasterror = False
@ -24,15 +24,15 @@ class SingleInstance(object):
# Create a temp file, copy it to pidPath and remove temporary file # Create a temp file, copy it to pidPath and remove temporary file
(fp, temp_path) = tempfile.mkstemp() (fp, temp_path) = tempfile.mkstemp()
try: try:
os.fdopen(fp, "w+b").write(str(os.getpid())) os.fdopen(fp, "w+b").write(bytes(os.getpid()))
shutil.copy(temp_path, pidPath) shutil.copy(temp_path, pidPath)
os.unlink(temp_path) os.unlink(temp_path)
except Exception as e: except Exception as e:
print str(e) print(str(e))
def is_already_running(self): def is_already_running(self):
return self.lasterror return self.lasterror
def __del__(self): def __del__(self):
if not self.lasterror: if not self.lasterror and os.path.exists(self.pidPath):
os.unlink(self.pidPath) os.unlink(self.pidPath)

View File

@ -1 +1 @@
#!/usr/bin/python #!/usr/bin/python3

View File

@ -66,13 +66,13 @@ class WizardEventBox(gtk.EventBox):
# 鼠标事件 # 鼠标事件
self.connect("button-press-event", self.on_button_press) self.connect("button-press-event", self.on_button_press)
# 幻灯片图片 # 幻灯片图片
self.slider_pics = map(gtk.gdk.pixbuf_new_from_file, slider_icons) self.slider_pics = list(map(gtk.gdk.pixbuf_new_from_file, slider_icons))
# 幻灯片总数 # 幻灯片总数
self.icon_num = len(slider_icons) self.icon_num = len(slider_icons)
# 滑动圆点图片设置 # 滑动圆点图片设置
self.pointer_pic, self.pointer_pic_active = map(gtk.gdk.pixbuf_new_from_file, pointer_icons) self.pointer_pic, self.pointer_pic_active = list(map(gtk.gdk.pixbuf_new_from_file, pointer_icons))
# 开始按钮图片设置 # 开始按钮图片设置
self.btn_pic, self.btn_pic_press = map(gtk.gdk.pixbuf_new_from_file, button_icons) self.btn_pic, self.btn_pic_press = list(map(gtk.gdk.pixbuf_new_from_file, button_icons))
button_size = 55 button_size = 55
self.pointer_dict = {} self.pointer_dict = {}
self.index = 0 self.index = 0
@ -141,7 +141,7 @@ class WizardEventBox(gtk.EventBox):
def on_motion_notify(self, widget, event): def on_motion_notify(self, widget, event):
self.show_index = None self.show_index = None
for index, rect in self.pointer_dict.items(): for index, rect in list(self.pointer_dict.items()):
if rect.x <= event.x <= rect.x + rect.width and rect.y <= event.y <= rect.y + rect.height: if rect.x <= event.x <= rect.x + rect.width and rect.y <= event.y <= rect.y + rect.height:
self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND2)) self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND2))
self.show_index = index self.show_index = index
@ -231,7 +231,7 @@ class Wizard(gtk.Window):
self.move_window_event(self.event_box) self.move_window_event(self.event_box)
def destroy_wizard(self, widget): def destroy_wizard(self, widget):
print 'Kylin-Assistant slide show is over!' print('Kylin-Assistant slide show is over!')
#widget.destory() #widget.destory()
def is_left_button(self, event): def is_left_button(self, event):

View File

@ -1 +1 @@
#!/usr/bin/python #!/usr/bin/python3

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2010 Canonical # Copyright (C) 2010 Canonical

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2010 Canonical # Copyright (C) 2010 Canonical
@ -45,9 +45,9 @@ def utf8(s):
""" """
if s is None: if s is None:
return None return None
if isinstance(s, unicode): if isinstance(s, str):
return s.encode("utf-8", "ignore") return s.encode("utf-8", "ignore")
return unicode(s, "utf8", "ignore").encode("utf8") return str(s, "utf8", "ignore").encode("utf8")
class LoginBackendDbusSSO(LoginBackend): class LoginBackendDbusSSO(LoginBackend):

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2010 Canonical # Copyright (C) 2010 Canonical
@ -33,17 +33,17 @@ import piston_mini_client.failhandlers
#from fake_review_settings import FakeReviewSettings, network_delay #from fake_review_settings import FakeReviewSettings, network_delay
#from spawn_helper import SpawnHelper #from spawn_helper import SpawnHelper
from login import get_login_backend from .login import get_login_backend
from piston.ubuntusso_pristine import ( from .piston.ubuntusso_pristine import (
UbuntuSsoAPI as PristineUbuntuSsoAPI, UbuntuSsoAPI as PristineUbuntuSsoAPI,
) )
# patch default_service_root to the one we use # patch default_service_root to the one we use
from enums import UBUNTU_KYLIN_SSO_SERVICE from .enums import UBUNTU_KYLIN_SSO_SERVICE
# *Don't* append /api/1.0, as it's already included in UBUNTU_SSO_SERVICE # *Don't* append /api/1.0, as it's already included in UBUNTU_SSO_SERVICE
PristineUbuntuSsoAPI.default_service_root = UBUNTU_KYLIN_SSO_SERVICE PristineUbuntuSsoAPI.default_service_root = UBUNTU_KYLIN_SSO_SERVICE
from enums import ( from .enums import (
SOFTWARE_CENTER_NAME_KEYRING, SOFTWARE_CENTER_NAME_KEYRING,
SOFTWARE_CENTER_SSO_DESCRIPTION, SOFTWARE_CENTER_SSO_DESCRIPTION,
) )
@ -101,7 +101,7 @@ class UbuntuSSO(GObject.GObject):
try: try:
res = api.whoami() res = api.whoami()
except piston_mini_client.failhandlers.APIError as e: except piston_mini_client.failhandlers.APIError as e:
print "api.whoami failed with APIError: '%s'" % e print("api.whoami failed with APIError: '%s'" % e)
LOG.exception("api.whoami failed with APIError: '%s'" % e) LOG.exception("api.whoami failed with APIError: '%s'" % e)
if len(res) == 0: if len(res) == 0:
self.emit("error") self.emit("error")

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
# Copyright (C) 2007-2011 Tualatrix Chou <tualatrix@gmail.com> # Copyright (C) 2007-2011 Tualatrix Chou <tualatrix@gmail.com>
@ -27,7 +27,7 @@ from single import SingleInstance
if __name__ == '__main__': if __name__ == '__main__':
myapp = SingleInstance("/tmp/kylin-assistant-sessiondbus-%d.pid" % os.getuid()) myapp = SingleInstance("/tmp/kylin-assistant-sessiondbus-%d.pid" % os.getuid())
if myapp.is_already_running(): if myapp.is_already_running():
print "Another instance of this sessiondbus is already running" print("Another instance of this sessiondbus is already running")
sys.exit("Another instance of this sessiondbus is already running") sys.exit("Another instance of this sessiondbus is already running")
from sessiondbus.daemon import SessionDaemon from sessiondbus.daemon import SessionDaemon
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
# Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd # Copyright (C) 2013 ~ 2014 National University of Defense Technology(NUDT) & Kylin Ltd
@ -26,7 +26,7 @@ from single import SingleInstance
if __name__ == '__main__': if __name__ == '__main__':
myapp = SingleInstance("/tmp/kylin-assistant-systemdbus-%d.pid" % os.getuid()) myapp = SingleInstance("/tmp/kylin-assistant-systemdbus-%d.pid" % os.getuid())
if myapp.is_already_running(): if myapp.is_already_running():
print "Another instance of this systemdbus is already running" print("Another instance of this systemdbus is already running")
sys.exit("Another instance of this systemdbus is already running") sys.exit("Another instance of this systemdbus is already running")
os.environ["TERM"] = "xterm" os.environ["TERM"] = "xterm"
os.environ["PATH"] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin" os.environ["PATH"] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin"

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
@ -194,7 +194,7 @@ class Sysinfo:
desktop_name = "N/A" desktop_name = "N/A"
return desktop_name return desktop_name
except Exception as e: except Exception as e:
print e print(e)
desktop = os.getenv('DESKTOP_SESSION') desktop = os.getenv('DESKTOP_SESSION')
if desktop in desktop_dict: if desktop in desktop_dict:
return desktop_dict[desktop] return desktop_dict[desktop]
@ -254,6 +254,6 @@ class Sysinfo:
if __name__ == '__main__': if __name__ == '__main__':
c = Sysinfo() c = Sysinfo()
print(c.get_sys_msg()) print((c.get_sys_msg()))
import getpass import getpass
print(getpass.getuser()) print((getpass.getuser()))

View File

@ -1 +1 @@
#!/usr/bin/python #!/usr/bin/python3

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import apt import apt
@ -68,11 +68,11 @@ class FetchProcess(apb.AcquireProgress):
self.dbus_service.youker_fetch_signal("down_fetch", kwarg) self.dbus_service.youker_fetch_signal("down_fetch", kwarg)
def ims_hit(self, item): def ims_hit(self, item):
print 'ims_hit' print('ims_hit')
pass pass
def media_change(self, media, drive): def media_change(self, media, drive):
print 'media_change' print('media_change')
pass pass
def pulse(self, owner): def pulse(self, owner):
@ -106,7 +106,7 @@ class FetchProcess(apb.AcquireProgress):
# cancel the operation # cancel the operation
if self.dbus_service.check_cancel_worker_item(self.appname) is True: if self.dbus_service.check_cancel_worker_item(self.appname) is True:
print "download_cancel" print("download_cancel")
self.dbus_service.youker_fetch_signal("down_cancel", kwarg) self.dbus_service.youker_fetch_signal("down_cancel", kwarg)
return False return False
@ -235,19 +235,19 @@ class AptHandler():
try: try:
self.cache.commit(FetchProcess(self.dbus_service, pkgName, AppActions.INSTALLDEPS), AptProcess(self.dbus_service, pkgName, AppActions.INSTALLDEPS)) self.cache.commit(FetchProcess(self.dbus_service, pkgName, AppActions.INSTALLDEPS), AptProcess(self.dbus_service, pkgName, AppActions.INSTALLDEPS))
except Exception, e: except Exception as e:
print e print(e)
print "install err" print("install err")
# install package # install package
def install(self, pkgName, kwargs=None): def install(self, pkgName, kwargs=None):
print "real install->", pkgName print("real install->", pkgName)
self.cache.open() self.cache.open()
pkg = self.get_pkg_by_name(pkgName) pkg = self.get_pkg_by_name(pkgName)
print pkg.installed.version#1.2.0-0ubuntu1 print(pkg.installed.version)#1.2.0-0ubuntu1
print len(pkg.versions)#2 print(len(pkg.versions))#2
print pkg.versions[0].version#1.3.1-0ubuntu1 print(pkg.versions[0].version)#1.3.1-0ubuntu1
print pkg.versions[1].version#1.2.0-0ubuntu1 print(pkg.versions[1].version)#1.2.0-0ubuntu1
# if pkg.is_installed: # if pkg.is_installed:
# raise WorkitemError(7, "Package %s is installed" % pkgName) # raise WorkitemError(7, "Package %s is installed" % pkgName)
pkg.mark_install() pkg.mark_install()
@ -306,14 +306,14 @@ class AptHandler():
try: try:
if quiet == True: if quiet == True:
print "quiet=True" print("quiet=True")
self.cache.update() self.cache.update()
else: else:
print "quiet=False" print("quiet=False")
self.cache.update(fetch_progress=FetchProcess(self.dbus_service, "#update", AppActions.UPDATE)) self.cache.update(fetch_progress=FetchProcess(self.dbus_service, "#update", AppActions.UPDATE))
except Exception, e: except Exception as e:
print e print(e)
print "update except" print("update except")
class WorkitemError(Exception): class WorkitemError(Exception):

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
### BEGIN LICENSE ### BEGIN LICENSE
@ -34,8 +34,8 @@ from gi.repository import GObject
#import aptsources.sourceslist #import aptsources.sourceslist
#import apt_pkg #import apt_pkg
import threading import threading
import thread import _thread
from server import PolicyKitService from .server import PolicyKitService
from policykit import KYLIN_ASSISTANT_ACTION from policykit import KYLIN_ASSISTANT_ACTION
import time import time
import cleaner import cleaner
@ -52,7 +52,7 @@ INTERFACE = 'com.kylin.assistant.systemdaemon'
UKPATH = '/com/kylin/assistant/systemdaemon' UKPATH = '/com/kylin/assistant/systemdaemon'
#------------------------------------apt start---------------------------- #------------------------------------apt start----------------------------
from apt_handler import AppActions, AptHandler, WorkitemError from .apt_handler import AppActions, AptHandler, WorkitemError
#class WorkItem: #class WorkItem:
# def __init__(self, pkgname, action, kwargs): # def __init__(self, pkgname, action, kwargs):
# self.pkgname = pkgname # self.pkgname = pkgname
@ -170,12 +170,12 @@ class Daemon(PolicyKitService):
#sudo apt-get install youker-assistant=1.3.1-0ubuntu1 #sudo apt-get install youker-assistant=1.3.1-0ubuntu1
@dbus.service.method(INTERFACE, in_signature='s', out_signature='b', sender_keyword='sender') @dbus.service.method(INTERFACE, in_signature='s', out_signature='b', sender_keyword='sender')
def install(self, pkgName, sender=None): def install(self, pkgName, sender=None):
print "####install: ",pkgName print("####install: ",pkgName)
# item = WorkItem(pkgName, AppActions.INSTALL, None) # item = WorkItem(pkgName, AppActions.INSTALL, None)
# self.add_worker_item(item) # self.add_worker_item(item)
# self.aptHandler.install(pkgName) # self.aptHandler.install(pkgName)
thread.start_new_thread(self.start_install_uk, (pkgName,)) _thread.start_new_thread(self.start_install_uk, (pkgName,))
print "####install return" print("####install return")
return True return True
def start_update_source_list(self): def start_update_source_list(self):
@ -183,7 +183,7 @@ class Daemon(PolicyKitService):
@dbus.service.method(INTERFACE, in_signature='', out_signature='b', sender_keyword='sender') @dbus.service.method(INTERFACE, in_signature='', out_signature='b', sender_keyword='sender')
def update(self, sender=None): def update(self, sender=None):
thread.start_new_thread(self.start_update_source_list, ()) _thread.start_new_thread(self.start_update_source_list, ())
# self.aptHandler.update() # self.aptHandler.update()
return True return True
@ -481,7 +481,7 @@ class Daemon(PolicyKitService):
t = threading.Thread(target = daemononekey.clean_all_onekey_crufts, args = (self, mode_list)) t = threading.Thread(target = daemononekey.clean_all_onekey_crufts, args = (self, mode_list))
t.start() t.start()
#daemononekey.clean_all_onekey_crufts(self, mode_list) #daemononekey.clean_all_onekey_crufts(self, mode_list)
except Exception, e: except Exception as e:
self.clean_error_msg('onekey') self.clean_error_msg('onekey')
else: else:
self.clean_complete_msg('onekey') self.clean_complete_msg('onekey')
@ -720,7 +720,7 @@ class Daemon(PolicyKitService):
return return
else: else:
self.quit_clean(True) self.quit_clean(True)
thread.start_new_thread(self.start_clean_all, (mode_dic,)) _thread.start_new_thread(self.start_clean_all, (mode_dic,))
# @dbus.service.method(INTERFACE, in_signature='s', out_signature='', sender_keyword='sender') # @dbus.service.method(INTERFACE, in_signature='s', out_signature='', sender_keyword='sender')
# def remove_file(self, fp): # def remove_file(self, fp):
# status = self._check_permission(sender, KYLIN_ASSISTANT_ACTION) # status = self._check_permission(sender, KYLIN_ASSISTANT_ACTION)

6
debian/control vendored
View File

@ -7,7 +7,7 @@ Uploaders:
Build-Depends: debhelper (>= 9), Build-Depends: debhelper (>= 9),
python-dev, python-dev,
python-lxml, python-lxml,
python-piston-mini-client, python3-piston-mini-client,
python-xdg, python-xdg,
qtbase5-dev (>= 5.1), qtbase5-dev (>= 5.1),
qt5-qmake, qt5-qmake,
@ -27,9 +27,9 @@ Depends: python-dbus,
python-lxml, python-lxml,
python-xdg, python-xdg,
python-apt, python-apt,
python-pil, python3-pil,
python-imaging, python-imaging,
python-piston-mini-client, python3-piston-mini-client,
python-compizconfig, python-compizconfig,
hdparm, hdparm,
lm-sensors, lm-sensors,

4
debian/links vendored
View File

@ -1,2 +1,2 @@
/usr/lib/python2.7/dist-packages/kylin-assistant-daemon/src/start_systemdbus.py /usr/bin/kylin-assistant-backend.py /usr/lib/python3/dist-packages/kylin-assistant-daemon/src/start_systemdbus.py /usr/bin/kylin-assistant-backend.py
/usr/lib/python2.7/dist-packages/kylin-assistant-daemon/src/start_sessiondbus.py /usr/bin/kylin-assistant-session.py /usr/lib/python3/dist-packages/kylin-assistant-daemon/src/start_sessiondbus.py /usr/bin/kylin-assistant-session.py