Beispiel #1
0
        def __init__(self, parent):
            WinterLine.__init__(self, parent)
            self.app = parent.app
            self.parent = parent

            complete_methods = []
            for obj in self.parent.app.script.objects:
                for i in dir(self.parent.app.script.objects[obj]):
                    if not i.startswith('_') and type(
                            getattr(self.parent.app.script.objects[obj],
                                    i)).__name__ == 'instancemethod':
                        complete_methods.append(i)
            if self.parent.app.config.options.plugins:
                for plugin in self.parent.app.pm.plugins:
                    try:
                        if plugin.name in self.parent.app.p_config.plugins.active:
                            for i in dir(plugin):
                                if not i.startswith('_') and type(
                                        getattr(
                                            plugin,
                                            i)).__name__ == 'instancemethod':
                                    complete_methods.append('%s.%s' %
                                                            (plugin.name, i))
                    except:
                        pass
            self.setComplete(complete_methods)
            if not self.parent.config.options.popup_completion:
                self.lineEditCompleter.setCompletionMode(
                    QCompleter.InlineCompletion)
            else:
                self.lineEditCompleter.setCompletionMode(
                    QCompleter.PopupCompletion)
Beispiel #2
0
        def __init__(self, parent):
            WinterLine.__init__(self, parent)
            self.app = parent.app
            self.parent = parent

            complete_methods = []
            for obj in self.parent.app.script.objects:
                for i in dir(self.parent.app.script.objects[obj]):
                    if not i.startswith('_') and type(
                        getattr(self.parent.app.script.objects[obj], i)).__name__ == 'instancemethod':
                        complete_methods.append(i)
            if self.parent.app.config.options.plugins:
                for plugin in self.parent.app.pm.plugins:
                    try:
                        if plugin.name in self.parent.app.p_config.plugins.active:
                            for i in dir(plugin):
                                if not i.startswith('_') and type(getattr(plugin, i)).__name__ == 'instancemethod':
                                    complete_methods.append('%s.%s' % (plugin.name, i))
                    except:
                        pass
            self.setComplete(complete_methods)
            if not self.parent.config.options.popup_completion:
                self.lineEditCompleter.setCompletionMode(QCompleter.InlineCompletion)
            else:
                self.lineEditCompleter.setCompletionMode(QCompleter.PopupCompletion)
Beispiel #3
0
    def __init__(self, parent):
        self.parent = parent
        WinterLine.__init__(self, parent.parent, 'Input command:')
        self.commands = {'tree': SBAction.objects.get(title='Content').forceShowWidget, 'new': self.parent.newPage,
                         'del': self.parent.tree.delPage, 'crypt': self.parent.tree.crypt,
                         'decrypt': self.parent.tree.decrypt, 'edit': SBAction.objects.get(title='Edit').forceShowWidget
            , 'ins': lambda *x: self.parent.tree.newPage(x, self.parent.tree.currentPage.path),
                         'view': self.parent.tree.viewPage}

        cc = [':%s' % c for c in self.commands]
        for page in Page.objects.all():
            cc.append(':view %s' % page.title)
        self.setComplete(cc)
        self.lineEditCompleter.setCompletionMode(QCompleter.InlineCompletion)

        self.api = API()