コード例 #1
0
def uninstall_plugin(plug):
    fileName = os.path.basename(plug[3])
    fileName = os.path.splitext(fileName)[0]
    fileName = resources.createpath(resources.plugins, fileName + '.json')
    descriptor = open(fileName, 'r')
    plugin = json.load(descriptor)
    descriptor.close()
    module = plugin.get('module', False)
    if module:
        pluginDir = resources.createpath(resources.plugins, module)
        folders = [pluginDir]
        for root, dirs, files in os.walk(pluginDir):
            pluginFiles = [resources.createpath(root, f) for f in files]
            map(os.remove, pluginFiles)
            folders += [resources.createpath(root, d) for d in dirs]
        folders.reverse()
        for f in folders:
            if os.path.isdir(f):
                os.removedirs(f)
        os.remove(fileName)
    structure = {}
    if os.path.isfile(resources.descriptor):
        read = open(resources.descriptor, 'r')
        structure = json.load(read)
        read.close()
    structure.pop(module)
    descriptor = open(resources.descriptor, 'w')
    json.dump(structure, descriptor, indent=2)
コード例 #2
0
ファイル: pluginmanager.py プロジェクト: calpe20/PYTHONIZANDO
def uninstall_plugin(plug):
    fileName = os.path.basename(plug[3])
    fileName = os.path.splitext(fileName)[0]
    fileName = resources.createpath(resources.plugins, fileName + '.json')
    descriptor = open(fileName, 'r')
    plugin = json.load(descriptor)
    descriptor.close()
    module = plugin.get('module', False)
    if module:
        pluginDir = resources.createpath(resources.plugins, module)
        folders = [pluginDir]
        for root, dirs, files in os.walk(pluginDir):
            pluginFiles = [resources.createpath(root, f) for f in files]
            map(os.remove, pluginFiles)
            folders += [resources.createpath(root, d) for d in dirs]
        folders.reverse()
        for f in folders:
            if os.path.isdir(f):
                os.removedirs(f)
        os.remove(fileName)
    structure = {}
    if os.path.isfile(resources.descriptor):
        read = open(resources.descriptor, 'r')
        structure = json.load(read)
        read.close()
    structure.pop(module)
    descriptor = open(resources.descriptor, 'w')
    json.dump(structure, descriptor, indent=2)
コード例 #3
0
ファイル: pluginmanager.py プロジェクト: calpe20/PYTHONIZANDO
def download_plugin(file_):
    fileName = resources.createpath(resources.plugins, os.path.basename(file_))
    content = urllib.urlopen(file_)
    f = open(fileName, 'wb')
    f.write(content.read())
    f.close()
    zipFile = zipfile.ZipFile(fileName, 'r')
    zipFile.extractall(resources.plugins)
    zipFile.close()
    os.remove(fileName)
コード例 #4
0
def download_plugin(file_):
    fileName = resources.createpath(resources.plugins, os.path.basename(file_))
    content = urllib.urlopen(file_)
    f = open(fileName, 'wb')
    f.write(content.read())
    f.close()
    zipFile = zipfile.ZipFile(fileName, 'r')
    zipFile.extractall(resources.plugins)
    zipFile.close()
    os.remove(fileName)
コード例 #5
0
ファイル: pluginmanager.py プロジェクト: calpe20/PYTHONIZANDO
def load_installed_plugin(plug):
    fileName = resources.createpath(resources.plugins, plug[0] + '.json')
    read = open(fileName, 'r')
    structure = json.load(read)
    read.close()
    module = structure.get('module', None)
    if module is not None:
        instance = load_module(module, resources.plugins)
        return [[instance, structure]]
    else:
        return []
コード例 #6
0
def load_installed_plugin(plug):
    fileName = resources.createpath(resources.plugins, plug[0] + '.json')
    read = open(fileName, 'r')
    structure = json.load(read)
    read.close()
    module = structure.get('module', None)
    if module is not None:
        instance = load_module(module, resources.plugins)
        return [[instance, structure]]
    else:
        return []
コード例 #7
0
 def onWizardFinish(self, wizard):
     ids = wizard.pageIds()
     page = wizard.page(ids[1])
     place = str(page.txtPlace.text())
     if place == '':
         QMessageBox.critical(self, 'Incorrect Location', 'The project couldn\'t be create')
         return
     folder = str(page.txtFolder.text())
     path = resources.createpath(place, folder)
     if not manage_files.folder_exists(path):
         manage_files.create_folder(path)
     project = {}
     name = str(page.txtName.text())
     project['name'] = name
     project['description'] = str(page.txtDescription.toPlainText())
     project['license'] = str(page.cboLicense.currentText())
     loader.create_ninja_project(path, name, project)
     self.load_project(path)
コード例 #8
0
 def onWizardFinish(self, wizard):
     ids = wizard.pageIds()
     page = wizard.page(ids[1])
     place = str(page.txtPlace.text())
     if place == '':
         QMessageBox.critical(self, 'Incorrect Location',
                              'The project couldn\'t be create')
         return
     folder = str(page.txtFolder.text())
     path = resources.createpath(place, folder)
     if not manage_files.folder_exists(path):
         manage_files.create_folder(path)
     project = {}
     name = str(page.txtName.text())
     project['name'] = name
     project['description'] = str(page.txtDescription.toPlainText())
     project['license'] = str(page.cboLicense.currentText())
     loader.create_ninja_project(path, name, project)
     self.load_project(path)
コード例 #9
0
ファイル: pluginmanager.py プロジェクト: calpe20/PYTHONIZANDO
def add_properties_panel(plug, instance, ide):
    icon = resources.createpath(resources.plugins, plug.get('icon', ''))
    name = plug.get('name', '')
    widget = instance.propertiesWidget()
    ide.main._properties.add_tab(widget, name, icon)
コード例 #10
0
ファイル: pluginmanager.py プロジェクト: calpe20/PYTHONIZANDO
def add_display(plug, instance, ide):
    icon = resources.createpath(resources.plugins, plug)
    ide.main.container.add_to_stack(instance.stackWidget(), icon)
コード例 #11
0
ファイル: pluginmanager.py プロジェクト: calpe20/PYTHONIZANDO
def add_toolbar_item(plug, instance, ide):
    icon = resources.createpath(resources.plugins, plug.get('icon', ''))
    ide.add_toolbar_item(instance, plug.get('name', ''), icon)
コード例 #12
0
def add_properties_panel(plug, instance, ide):
    icon = resources.createpath(resources.plugins, plug.get('icon', ''))
    name = plug.get('name', '')
    widget = instance.propertiesWidget()
    ide.main._properties.add_tab(widget, name, icon)
コード例 #13
0
def add_display(plug, instance, ide):
    icon = resources.createpath(resources.plugins, plug)
    ide.main.container.add_to_stack(instance.stackWidget(), icon)
コード例 #14
0
def add_toolbar_item(plug, instance, ide):
    icon = resources.createpath(resources.plugins, plug.get('icon', ''))
    ide.add_toolbar_item(instance, plug.get('name', ''), icon)