def __init__(self, parent=None, pth=None): QtGui.QWidget.__init__(self, parent) self.ui = Ui_Form() self.ui.setupUi(self) self.IDE = parent # Add Ace editor if 'ace' in self.IDE.editorD: import plugins.ace.ace self.ui.te_json = plugins.ace.ace.WebView(self.IDE, lang='json') else: # Add Scintilla import plugins.scintilla.scintilla self.ui.te_json = plugins.scintilla.scintilla.Sci( self.IDE, Qsci.QsciLexerJavaScript(), lang='json') self.ui.fr_json.layout().addWidget(self.ui.te_json) # Setup Plugins file if not os.path.exists( os.path.join(self.IDE.settingPath, 'plugins.json')): import shutil shutil.copyfile( os.path.abspath(os.path.dirname(__file__)) + '/plugins.json', os.path.join(self.IDE.settingPath, 'plugins.json')) self.ui.split_v.setSizes([self.IDE.width() / 2, self.IDE.width() / 2]) self.ui.split_h.setSizes( [self.IDE.height() / 2, self.IDE.height() / 2]) self.ui.fr_plugins.hide() # Signals self.ui.li_catg.currentRowChanged.connect(self.catg_change) self.ui.b_save_json.clicked.connect(self.save_json) self.ui.tr_plugins.itemDoubleClicked.connect(self.plugin_dclick) self.ui.b_plugin_file_add.clicked.connect(self.plugin_add_file) self.ui.b_plugin_url_add.clicked.connect(self.plugin_add_url) self.ui.b_plugin_manual_add.clicked.connect(self.plugin_add_manual) self.ui.tr_plugins.itemSelectionChanged.connect(self.plugin_select) self.ui.li_catg.setCurrentRow(0)
def SetScintillaProperties(framework, scintillaWidget, contentType='html'): lexerInstance = None font = framework.get_font() if 'html' == contentType: lexerInstance = Qsci.QsciLexerHTML(scintillaWidget) elif 'javascript' == contentType: lexerInstance = Qsci.QsciLexerJavaScript(scintillaWidget) elif 'python' == contentType: lexerInstance = Qsci.QsciLexerPython(scintillaWidget) font = framework.get_python_code_font() elif contentType in ('hex', 'monospace'): font = framework.get_monospace_font() else: pass scintillaWidget.setFont(font) scintillaWidget.setWrapMode(1) scintillaWidget.zoomTo(framework.get_zoom_size()) # TOOD: set based on line numbers (size is in pixels) scintillaWidget.setMarginWidth(1, '1000') if lexerInstance is not None: lexerInstance.setFont(font) scintillaWidget.setLexer(lexerInstance)