def __init__(self, appid): td.Thread.__init__(self) self.daemon = True self.appid = appid self.desc_info_path = os.path.expanduser( "~/.cache/deepin-game-center/downloads/%s/info.json" % self.appid) touch_file_dir(self.desc_info_path)
def __init__(self, cache): self.cache = cache self.db_path = os.path.join(get_parent_dir(__file__, 3), "data/cache_soft.db") remove_file(self.db_path) touch_file_dir(self.db_path) self.connect = sqlite3.connect(self.db_path) self.cursor = self.connect.cursor() self.cursor.execute( "CREATE TABLE IF NOT EXISTS software (\ pkg_name PRIMARY KEY NOT NULL, short_desc, long_desc, version, \ homepage, size)") for pkg in self.cache: try: self.cursor.execute( "INSERT INTO software VALUES(?,?,?,?,?,?)", (pkg.name, unicode(pkg.candidate.summary), unicode(pkg.candidate.description), unicode(pkg.candidate.version), unicode(pkg.candidate.homepage), unicode(pkg.candidate.size) )) except Exception, e: print "Error in db_build: %s %s" % (e, pkg.name)
def __init__(self, cache): self.cache = cache self.db_path = os.path.join(get_parent_dir(__file__, 3), "data/cache_soft.db") remove_file(self.db_path) touch_file_dir(self.db_path) self.connect = sqlite3.connect(self.db_path) self.cursor = self.connect.cursor() self.cursor.execute("CREATE TABLE IF NOT EXISTS software (\ pkg_name PRIMARY KEY NOT NULL, short_desc, long_desc, version, \ homepage, size)") for pkg in self.cache: try: self.cursor.execute("INSERT INTO software VALUES(?,?,?,?,?,?)", (pkg.name, unicode(pkg.candidate.summary), unicode(pkg.candidate.description), unicode(pkg.candidate.version), unicode(pkg.candidate.homepage), unicode(pkg.candidate.size))) except Exception, e: print "Error in db_build: %s %s" % (e, pkg.name)
def copy_to_mytheme(): names = sys.argv[1::] for name in names: for color in os.listdir(desc_dir): old_path = os.path.join(old_dir, color, "image", name) desc_path = os.path.join(desc_dir, color, 'image', name) touch_file_dir(desc_path) os.system("cp %s %s" % (old_path, desc_path)) print "copy: %s -> %s" % (old_path, desc_path)
def __init__(self, cookie_filepath=None): """ Init for WebView. @param cookie_filepath: Filepath to save cookie. """ webkit.WebView.__init__(self) self.cookie_filepath = cookie_filepath if self.cookie_filepath != None: touch_file_dir(cookie_filepath) dtk_webkit_cookie.add_cookie(cookie_filepath) settings = self.get_settings() settings.set_property("enable-default-context-menu", False) self.connect("set-scroll-adjustments", self.save_adjustment) self.connect("scroll-event", self.do_scroll)
def __init__(self, cookie_filepath=None): ''' Init for WebView. @param cookie_filepath: Filepath to save cookie. ''' webkit.WebView.__init__(self) self.cookie_filepath = cookie_filepath if self.cookie_filepath != None: touch_file_dir(cookie_filepath) dtk_webkit_cookie.add_cookie(cookie_filepath) settings = self.get_settings() settings.set_property("enable-default-context-menu", False) self.connect("set-scroll-adjustments", self.save_adjustment) self.connect("scroll-event", self.do_scroll)
def show_loading_page(self): touch_file_dir(self.swf_save_path) print "Touch file dir:", self.swf_save_path self.load_html_path = os.path.join(static_dir, 'loading.html') self.send_message('load_loading_uri', 'file://' + self.load_html_path) print "Send show loading message:", self.load_html_path
def touch_file_dir(filepath): print "Please import deepin_utils.file.touch_file_dir, this function will departed in next release version." return file.touch_file_dir(filepath)
def __init__(self, appid): td.Thread.__init__(self) self.daemon = True self.appid = appid self.desc_info_path = os.path.expanduser("~/.cache/deepin-game-center/downloads/%s/info.json" % self.appid) touch_file_dir(self.desc_info_path)