Beispiel #1
0
 def _afterAppInit(self):
     self.allow_br = False
     WinterEditor._afterAppInit(self)
     self.tb_2 = QToolBar(self)
     self.layout().insertWidget(1, self.tb_2)
     ak = self.api.ex('createAction')('circle-plus', 'Add key', self.addKey, keyseq=QKeySequence.New)
     self.tb_2.addAction(ak)
Beispiel #2
0
 def __init__(self, parent, **kwargs):
     self.parent = parent
     self.editor = None
     self.collection = None
     self.api = None
     WinterEditor.__init__(self, parent, **kwargs)
     WinterEditor.__refs__[WinterEditor].append(weakref.ref(self))   #this is bad=(
     self.setLexer(JSONLexer(self.parent, self))
Beispiel #3
0
 def __init__(self, parent, panel):
     self.parent = parent
     self.panel = panel
     filename = panel.tree.currentPage.path + '/__page.css'
     self.editor = WinterEditor(parent, filename, lexer='CSS')
     self.editor.onSave = lambda: self.onSave()
     self.editor.tb.hide()
     #            self.editor.editor.setLexer()
     FocusProxy.__init__(self, self.editor)
     l = QVBoxLayout()
     l.addWidget(self.editor)
     self.setLayout(l)
Beispiel #4
0
    def __init__(self, app):
        QDockWidget.__init__(self)
        self.setObjectName('debug')
        cfgfile = open('%sconfig/debug.cfg' % CWD)
        self.config = Config(cfgfile)
        self.exceptions = []
        self.app = app
        self.api = app.api
        widget = QTabWidget()
        log = QWidget()
        try:
            todo = WinterEditor(self.app, CWD + 'TODO', lexer='Plain')
        except IOError:
            todo = False
        self.errorList = self.WinterErrorList(self)
        widget.addTab(log, 'Log')
        widget.addTab(self.errorList, 'Errors')
        if todo:
            widget.addTab(todo, 'ToDo')
        layout = QVBoxLayout(log)
        self.debugLine = self.WinterDebugLine(self)
        self.debugList = QListWidget()
        self.debugList.setObjectName('debugList')
        layout.addWidget(self.debugLine)
        layout.addWidget(self.debugList)
        log.setLayout(layout)
        self.setWidget(widget)

        self.app.addDockWidget(Qt.BottomDockWidgetArea, self)
        self.hide()

        if os.path.isfile(CWD + 'config/debug.qss'):
            self.setStyleSheet(open(CWD + 'config/debug.qss', 'r').read())
Beispiel #5
0
class CssPanel(FocusProxy):
    def __init__(self, parent, panel):
        self.parent = parent
        self.panel = panel
        filename = panel.tree.currentPage.path + '/__page.css'
        self.editor = WinterEditor(parent, filename, lexer='CSS')
        self.editor.onSave = lambda: self.onSave()
        self.editor.tb.hide()
        #            self.editor.editor.setLexer()
        FocusProxy.__init__(self, self.editor)
        l = QVBoxLayout()
        l.addWidget(self.editor)
        self.setLayout(l)

    def onShow(self):
        self.editor.open(self.panel.tree.currentPage.path + '/__page.css')

    def onSave(self):
        self.parent.statusBar.showMessage('Style for %s saved' % self.panel.tree.currentPage.title)
        self.panel.view.js('reloadStylesheets()')
Beispiel #6
0
 def setText(self, content):
     if self.allow_br:
         content = '\n'.join(content.split("\\n"))
     WinterEditor.setText(self, content)