示例#1
0
 def colorChange(self, text, color):
     #print "colorChange ",text,color
     editStyle = config.readStyle()
     editStyle[text] = color
     config.writeStyle(editStyle)
     for i in range(len(self.parent.files)):
         self.parent.tabWidget.widget(i).setEditorStyle()
示例#2
0
 def setEditorStyle(self):
     ''' Bolldy some problem here the margin bg color is not set when init'ed '''
     ''' But when i change it in the styles menu it changes sad'''
     editStyle = config.readStyle()
     self.setCaretLineBackgroundColor(QColor(editStyle["caret"]))
     self.setMarginsBackgroundColor(QColor(editStyle["margin"]))
     self.setMarkerBackgroundColor(QColor(editStyle["marker"]),self.ARROW_MARKER_NUM)
     self.lexer.setColors(editStyle)
示例#3
0
 def setApi(self, text):
     self.api = QsciAPIs(self.lexer)
     self.api.load(ospathjoin(apiDir,text+".api"))
     self.api.prepare()
     self.lexer.setAPIs(self.api) #Very important do not change line otherwise gg
     self.setLexer(self.lexer) #Very important do not change line otherwise gg
     editStyle = config.readStyle()
     self.setMarginsBackgroundColor(QColor(editStyle["margin"]))
     '''This is done cause the margin color is set only when lexer is set 
示例#4
0
 def initStyleMenu(self):
     editStyle = config.readStyle()
     self.action_Style = QAction(Icons.style, 'Style', self) 
     men = QMenu(self)
     men1 = QMenu()
     self.base = StyleWidget(self,"base",editStyle["base"])
     self.back = StyleWidget(self,"back",editStyle["back"])
     self.caret = StyleWidget(self,"caret",editStyle["caret"])
     self.margin = StyleWidget(self,"margin",editStyle["margin"])
     self.marker = StyleWidget(self,"marker",editStyle["marker"])
     self.comment = StyleWidget(self,"comment",editStyle["comment"])
     self.number = StyleWidget(self,"number",editStyle["number"])
     self.keyword = StyleWidget(self,"keyword",editStyle["keyword"])
     self.string = StyleWidget(self,"string",editStyle["string"])
     self.operator = StyleWidget(self,"operator",editStyle["operator"])
     self.connect(self.base, SIGNAL("colorChange"),self.colorChange)
     self.connect(self.back, SIGNAL("colorChange"),self.colorChange)
     self.connect(self.caret, SIGNAL("colorChange"),self.colorChange)
     self.connect(self.margin, SIGNAL("colorChange"),self.colorChange)
     self.connect(self.marker, SIGNAL("colorChange"),self.colorChange)
     self.connect(self.comment, SIGNAL("colorChange"),self.colorChange)
     self.connect(self.number, SIGNAL("colorChange"),self.colorChange)
     self.connect(self.keyword, SIGNAL("colorChange"),self.colorChange)
     self.connect(self.string, SIGNAL("colorChange"),self.colorChange)
     self.connect(self.operator, SIGNAL("colorChange"),self.colorChange)
     self.baseMenu = QWidgetAction(men)
     self.baseMenu.setDefaultWidget(self.base)
     self.backMenu = QWidgetAction(men)
     self.backMenu.setDefaultWidget(self.back)
     self.caretMenu = QWidgetAction(men)
     self.caretMenu.setDefaultWidget(self.caret)
     self.marginMenu = QWidgetAction(men)
     self.marginMenu.setDefaultWidget(self.margin)
     self.markerMenu = QWidgetAction(men)
     self.markerMenu.setDefaultWidget(self.marker)
     self.commentMenu = QWidgetAction(men)
     self.commentMenu.setDefaultWidget(self.comment)
     self.numberMenu = QWidgetAction(men)
     self.numberMenu.setDefaultWidget(self.number)
     self.keywordMenu = QWidgetAction(men)
     self.keywordMenu.setDefaultWidget(self.keyword)
     self.stringMenu = QWidgetAction(men)
     self.stringMenu.setDefaultWidget(self.string)
     self.operatorMenu = QWidgetAction(men)
     self.operatorMenu.setDefaultWidget(self.operator)
     self.styleGroup = QActionGroup(self)
     self.styleGroup.setExclusive(True)
     self.styleGroup.selected.connect(self.setColors)
     self.style1 = QAction("All Hallow's Eve",self.styleGroup)
     self.style1.setCheckable(True)
     self.style2 = QAction("Amy",self.styleGroup)
     self.style2.setCheckable(True)
     self.style3 = QAction("Aptana Studio",self.styleGroup)
     self.style3.setCheckable(True)
     self.style4 = QAction("Bespin",self.styleGroup)
     self.style4.setCheckable(True)
     self.style5 = QAction("Blackboard",self.styleGroup)
     self.style5.setCheckable(True)
     self.style6 = QAction("Choco",self.styleGroup)
     self.style6.setCheckable(True)
     self.style7 = QAction("Cobalt",self.styleGroup)
     self.style7.setCheckable(True)
     self.style8 = QAction("Dawn",self.styleGroup)
     self.style8.setCheckable(True)
     self.style9 = QAction("Eclipse",self.styleGroup)
     self.style9.setCheckable(True)
     self.styleGroup.addAction(self.style1)
     self.styleGroup.addAction(self.style2)
     self.styleGroup.addAction(self.style3)
     self.styleGroup.addAction(self.style4)
     self.styleGroup.addAction(self.style5)
     self.styleGroup.addAction(self.style6)
     self.styleGroup.addAction(self.style7)
     self.styleGroup.addAction(self.style8)
     self.styleGroup.addAction(self.style9)
     men1.addAction(self.baseMenu)
     men1.addAction(self.backMenu)
     men1.addAction(self.caretMenu)
     men1.addAction(self.marginMenu)
     men1.addAction(self.markerMenu)
     men1.addAction(self.commentMenu)
     men1.addAction(self.numberMenu)
     men1.addAction(self.keywordMenu)
     men1.addAction(self.stringMenu)
     men1.addAction(self.operatorMenu)
     men1.addSeparator()
     men2 = QMenu(self)
     men2.setTitle("Styles")
     men2.addActions(self.styleGroup.actions())
     men1.addMenu(men2)
     self.action_Style.setMenu(men1)
     self.addAction(self.action_Style)