Esempio n. 1
0
 def setMargin(self):
     mar = config.margin()
     if(mar == 0): 
         config.setMargin(1)
         for i in range(len(self.files)):
             self.tabWidget.widget(i).setMargin(1)
     else:
         config.setMargin(0)
         for i in range(len(self.files)):
             self.tabWidget.widget(i).setMargin(0)
Esempio n. 2
0
 def initOptionsMenu(self):
     men = QMenu()
     
     #Threshold Slider
     self.threshSlider = QSlider()
     self.threshSlider.setTickPosition(QSlider.TicksLeft)
     self.threshSlider.setOrientation(Qt.Horizontal)
     self.threshSlider.setValue(config.thresh())
     self.threshSlider.setMinimum(0)
     self.threshSlider.setMaximum(5)
     self.threshSlider.valueChanged.connect(self.parent.setThreshold)
     self.threshSliderAction = QWidgetAction(men)
     self.threshSliderAction.setDefaultWidget(self.threshSlider)
     
     #TabsWidth Slider
     self.tabsSlider = QSlider()
     self.tabsSlider.setTickPosition(QSlider.TicksLeft)
     self.tabsSlider.setOrientation(Qt.Horizontal)
     self.tabsSlider.setValue(config.tabwidth())
     self.tabsSlider.setMinimum(0)
     self.tabsSlider.setMaximum(8)
     self.tabsSlider.valueChanged.connect(self.parent.setTabWidth)
     self.tabsSliderAction = QWidgetAction(men)
     self.tabsSliderAction.setDefaultWidget(self.tabsSlider)
     
     #iconSize Slider
     self.iconSlider = QSlider()
     self.iconSlider.setTickPosition(QSlider.TicksLeft)
     self.iconSlider.setOrientation(Qt.Horizontal)
     self.iconSlider.setValue(config.iconSize())
     self.iconSlider.setMinimum(16)
     self.iconSlider.setMaximum(32)
     self.iconSlider.setSingleStep(2)
     self.iconSlider.valueChanged.connect(self.setIcon)
     self.iconSliderAction = QWidgetAction(men)
     self.iconSliderAction.setDefaultWidget(self.iconSlider)
     
     '''Font Button'''
     self.fontCombo = QFontComboBox()
     self.fontCombo.currentFontChanged.connect(self.parent.setFont)
     self.fontCombo.setCurrentFont(QFont(config.fontName()))
     self.fontComboMenu = QWidgetAction(men)
     self.fontComboMenu.setDefaultWidget(self.fontCombo)
     
     '''Font Size'''
     self.fontSizeCombo = QComboBox()
     for size in range(1,40):
         self.fontSizeCombo.addItem(str(size))
     self.fontSizeCombo.setCurrentIndex(config.fontSize())
     self.fontSizeCombo.currentIndexChanged.connect(self.parent.setFontSize)
     self.fontSizeComboMenu = QWidgetAction(men)
     self.fontSizeComboMenu.setDefaultWidget(self.fontSizeCombo)
     
     
     action_Android = QAction(Icons.android,'Android', self)
     action_Android.triggered.connect(self.parent.android)
     action_Ant = QAction(Icons.ant_view,'Ant', self)
     action_Ant.triggered.connect(self.parent.antt)
     action_Squirrel = QAction(Icons.nut,'Squirrel', self)
     action_Squirrel.triggered.connect(self.parent.squirrel)
     action_Ios1 = QAction(Icons.ios,'iOS', self)
     action_Update = QAction(Icons.update,"Update",self)
     action_Update.triggered.connect(self.parent.update)
     
     action_explorer = QAction("Explorer",self)
     action_explorer.triggered.connect(self.parent.exp)
     action_explorer.setCheckable(True)
     action_explorer.setChecked(True)
     action_console = QAction("Console",self)
     action_console.triggered.connect(self.parent.cmd)
     action_console.setCheckable(True)
     action_console.setChecked(False)
     #action_designer = QAction("Designer",self)
     #action_designer.triggered.connect(self.parent.design)
     action_Indentation = QAction("Indentation Guides",self)
     action_Indentation.triggered.connect(self.parent.setIndent)
     action_Indentation.setCheckable(True)
     action_Indentation.setChecked(config.indent())
     action_WhiteSpace = QAction("WhiteSpace",self)
     action_WhiteSpace.triggered.connect(self.parent.setWhiteSpace)
     action_WhiteSpace.setCheckable(True)
     action_WhiteSpace.setChecked(config.whiteSpace())
     action_EndLine = QAction("End of Lines",self)
     action_EndLine.triggered.connect(self.parent.setEndLine)
     action_EndLine.setCheckable(True)
     action_Margin = QAction("Line Numbers",self)
     action_Margin.triggered.connect(self.parent.setMargin)
     action_Margin.setCheckable(True)
     action_Margin.setChecked(config.margin())
     action_ToolLabel = QAction("Tool Labels",self)
     action_ToolLabel.triggered.connect(self.setToolLabel)
     action_ToolLabel.setCheckable(True)
     #action_ToolLabel.setChecked(config.toolLabel())
     
     '''Encoding'''
     encodingGroup = QActionGroup(self)
     encodingGroup.setExclusive(True)
     action_Ascii = QAction("Ascii",encodingGroup)
     action_Ascii.setCheckable(True)
     action_Unicode = QAction("Unicode",encodingGroup)
     action_Unicode.setCheckable(False)
     encodingGroup.addAction(action_Ascii)
     encodingGroup.addAction(action_Unicode)
     encodingGroup.selected.connect(self.parent.setEncoding)
     if(config.encoding() == Encoding.ASCII):
         action_Ascii.setChecked(True)
     else:
         action_Unicode.setChecked(True)
     men.addAction(action_Update)
     men.addAction(self.action_Help)
     men.addAction(self.action_Full)
     men.addSeparator()
     men.addAction(action_Android)
     men.addAction(action_Ant)
     men.addAction(action_Squirrel)
     men.addAction(action_Ios1)
     
     men.addSeparator()
     men.addAction(action_explorer)
     men.addAction(action_console)
     #men.addAction(action_designer)
     men.addSeparator()
     men.addAction(action_Indentation)
     men.addAction(action_WhiteSpace)
     men.addAction(action_EndLine)
     men.addAction(action_Margin)
     men.addAction(action_ToolLabel)
     men.addSeparator()
     men.addActions(encodingGroup.actions())
     men.addSeparator()
     head_font = QLabel("Font---------------------")
     fnt = head_font.font()
     fnt.setBold(True)
     head_font.setFont(fnt)
     head_fontWidgetAction = QWidgetAction(men)
     head_fontWidgetAction.setDefaultWidget(head_font)
     men.addAction(head_fontWidgetAction)
     men.addAction(self.fontComboMenu)
     men.addAction(self.fontSizeComboMenu)
     men.addSeparator()
     men.addAction(QAction("TabWidth",self))
     men.addAction(self.tabsSliderAction)
     men.addSeparator()
     men.addAction(QAction("Threshold",self))
     men.addAction(self.threshSliderAction)
     #men.addAction(QAction("Icon Size",self))
     #men.addAction(self.iconSliderAction)
     
     self.action_Options = QAction(Icons.emblem_system, 'Options', self)
     self.action_Options.setMenu(men)
     self.addAction(self.action_Options)
Esempio n. 3
0
 def init(self):
     #Margin
     #print self.marginType(self.SymbolMargin)
     # Clickable margin 1 for showing markers
     self.setMarginSensitivity(0, True)
     #self.setMarginsBackgroundColor(self.colorStyle.margin)
     #self.connect(self,SIGNAL('marginClicked(int, int, Qt::KeyboardModifiers)'),self.on_margin_clicked)
     self.cursorPositionChanged.connect(self.parent.updateLine)
     # Margin 0 is used for line numbers
     #self.setMarginLineNumbers(0, True)
     #self.setMarginWidth(0, self.fontmetrics.width("0000") + 6)
     self.setMargin(config.margin())
     #self.linesChanged.connect(self.changeMarginWidht())           
     #Caret
     self.setCaretLineBackgroundColor(self.colorStyle.caret)
     self.setCaretLineVisible(True)
     
     #Indicator
     #self.setIndicatorForegroundColor(self.colorStyle.color)
     #self.setIndicatorOutlineColor(self.colorStyle.paper)
     
     #Marker
     self.markerDefine(QsciScintilla.RightArrow,self.ARROW_MARKER_NUM)
     self.markerDefine(Auto.auto_error,0)
     self.setMarkerBackgroundColor(self.colorStyle.marker,self.ARROW_MARKER_NUM)
     self.font = QFont(config.fontName(),config.fontSize())
     #self.font.setFixedPitch(True)
     self.setFont(self.font)
     self.fontmetrics = QFontMetrics(self.font)
     self.setMarginsFont(self.font)
     
     #Code-Complete
     self.registerImage(0,Auto.auto_class2)
     self.registerImage(1,Auto.auto_method)
     self.registerImage(2,Auto.auto_field)
     self.registerImage(3,Auto.auto_package)
     self.setAutoCompletionThreshold(config.thresh())
     self.setAutoCompletionSource(QsciScintilla.AcsAPIs)
     self.setBraceMatching(QsciScintilla.SloppyBraceMatch)
     self.setBackspaceUnindents(True)
     self.setAutoCompletionCaseSensitivity(True)
     self.setIndentationsUseTabs(True)
     self.setTabIndents(True)
     self.setAutoIndent(True)
     self.setIndent(config.indent())
     #self.copyAvailable.connect(self.highlightWord)
     #self.indicatorClicked.connect(self.indicate)
     self.setIndicatorOutlineColor(QColor("#FFFFFF"))
     self.indicatorDefine(self.INDIC_BOX)
     self.setFolding(QsciScintilla.BoxedTreeFoldStyle)
     #self.setAutoCompletionSource(QsciScintilla.AcsAll)
     #self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier')
     #self.setIndentation(5,25)
     #self.setSelectionBackgroundColor()
     #self.setSelectionForegroundColor()
     #self.SendScintilla(QsciScintilla.SCI_MARKERSETBACK,11,QColor(220,220,220))
     self.setLanguage()
     self.lexer.setDefaultFont(self.font)
     self.api = QsciAPIs(self.lexer)
     self.api.load(ospathjoin(apiDir,"emo.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
Esempio n. 4
0
 def __init__(self,parent,text,nfile):
     QsciScintilla.__init__(self,parent)
     self.parent = parent
     self.errorLines = []
     self.setText(text)
     if(config.encoding() == Encoding.ASCII):
         self.setUtf8(False)
         #print "ascii set"
     else:
         self.setUtf8(True)
         #print "unicode set"
     if(eol == 0):
         self.setEolMode(self.EolWindows)
     elif(eol == 1):
         self.setEolMode(self.EolUnix)
     else:
         self.setEolMode(self.EolMac)
     if(config.whiteSpace()):
         self.setWhitespaceVisibility(True)
         
     self.cursorPositionChanged.connect(self.parent.updateLine)
     #self.linesChanged.connect(self.changeMarginWidht())           
     #Indicator
     #self.setIndicatorForegroundColor(self.colorStyle.color)
     #self.setIndicatorOutlineColor(self.colorStyle.paper)
     #Marker
     self.markerDefine(QsciScintilla.RightArrow,self.ARROW_MARKER_NUM)
     self.markerDefine(Auto.auto_error,0)
     self.font = QFont(config.fontName(),config.fontSize())
     #self.font.setFixedPitch(True)
     self.setFont(self.font)
     self.fontmetrics = QFontMetrics(self.font)
     self.setMarginsFont(self.font)
     
     # Margin 0 is used for line numbers
     self.setMarginSensitivity(0, True)
     #self.connect(self,SIGNAL('marginClicked(int, int, Qt::KeyboardModifiers)'),self.on_margin_clicked)
     self.setCaretLineVisible(True)
     #Code-Complete
     self.registerImage(0,Auto.auto_class2)
     self.registerImage(1,Auto.auto_method)
     self.registerImage(2,Auto.auto_field)
     self.registerImage(3,Auto.auto_package)
     self.setAutoCompletionThreshold(config.thresh())
     self.setAutoCompletionSource(QsciScintilla.AcsAPIs)
     self.setBraceMatching(QsciScintilla.SloppyBraceMatch)
     self.setBackspaceUnindents(True)
     self.setAutoCompletionCaseSensitivity(True)
     self.setIndentationsUseTabs(True)
     self.setTabIndents(True)
     self.setAutoIndent(True)
     self.setMargin(config.margin())
     self.setIndent(config.indent())
     self.setTabWidth(config.tabwidth())
     #self.copyAvailable.connect(self.highlightWord)
     #self.indicatorClicked.connect(self.indicate)
     self.setIndicatorOutlineColor(QColor("#000000"))
     self.indicatorDefine(self.INDIC_BOX)
     #self.setFolding(QsciScintilla.BoxedTreeFoldStyle)
     #self.setAutoCompletionSource(QsciScintilla.AcsAll)
     #self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier')
     #self.setIndentation(5,25)
     #self.setSelectionBackgroundColor()
     #self.setSelectionForegroundColor()
     #self.SendScintilla(QsciScintilla.SCI_MARKERSETBACK,11,QColor(220,220,220))
     self.setLanguage(nfile)
     self.setEditorStyle() #important must not change this position
     self.setApi("emo")