예제 #1
0
 def on_load_mouseClick(self,event):
     a=open("nidlist.tmp","r")# open saved nids(presaved result of plugin.listall())
     b=a.readlines()
     a=plugin.get_nid_by_name(b,self.components.List1.stringSelection) # get nid by using the selection in List1
     # ---Set Component values---
     self.components.NameF.text=nID.parse(a, "name")
     self.components.VersionF.text=nID.parse(a, "version")
     self.components.OwnerF.text=nID.parse(a, "Author")
     self.components.DescriptionF.text=nID.parse(a, "Description")
예제 #2
0
def install(nid):
    parsed=nID.parse(nid,"url")#get url from nid argument
    version=nID.parse(nid,"version")
    a=download(parsed)# download url parsed above
    zipped=open("temp/download.zip","w")# write downloaded data to a file
    zipped.write(a)
    zipped.close()
    unzip=zipfile.ZipFile("temp/download.zip","r")# start unzip data usin zipfile
    path=nID.parse(nid,"name")
    unzip.extractall("Plugins/"+path)# end
    a=open("prop/"+path+".prop","w")#write prop
    a.write(version)
    return true
예제 #3
0
 def on_Installed_mouseClick(self, event):
     nids=plugin.get_local_nids()
     final=[]
     for i in nids:#create a nidlist of installed plugins
         now=nID.parse(i, "name")
         final.append(now)
     self.components.List1.items=final
예제 #4
0
def get_fields_from_repo(repository_nid, field):
    list_of_all=[]
    a=nID.parse(repository_nid,"all_url")
    text=download(a)
    try:
        split=text.split("\n")#split the downloaded data
    except:
        print("Could not parse downloaded data!")
        sys.exit()#exit if the downloaded data could not be parsed(may happen if the download module couldn't finish the download)
    b=open("nidlist.tmp","w")#presave the downloaded data(the GUI uses this file in on_load)
    for i in split:
        b.write(i+"\n")
        parsed=nID.parse(i,field)
        list_of_all.append(parsed)#pick the fields from the nids
    print("[GetFieldsFromRepo] nidlist saved!")# notify console for filesaving
    b.close()
    return list_of_all
예제 #5
0
def get_nid_by_name(nids_list, name):
    #WARNING! This function may be removed in a future release
    for i in nids_list:
        a=nID.parse(i, "name")
        if a == name:
            return i
예제 #6
0
def uninstall(nid):
    name=nID.parse(nid,"name")
    os.remove("prop/"+name+".prop")#delete prop
    os.removedirs("Plugins/"+name)# and plugin folder