0914f3a9 pyros2097

13 years ago
Saving
Files changed (4) hide show
  1. Widget/LexerSquirrel.py +0 -10
  2. Widget/editor.py +13 -7
  3. Widget/editor.pyc +0 -0
  4. main.py +0 -2
Widget/LexerSquirrel.py CHANGED
@@ -2,16 +2,6 @@ from PyQt4.Qsci import QsciLexerCustom,QsciStyle
2
2
  from PyQt4.QtCore import QString
3
3
  from PyQt4.QtGui import *
4
4
 
5
- #class QsciLexerSquirrel(QsciLexer):
6
-
7
- # def __init__(self):
8
- # pass
9
- #prefs.declare('font.name.margin', "MS Dlg")
10
- #prefs.declare('font.size.margin', 8)
11
- #prefs.declare('font.name.code', "Courier New")
12
- #prefs.declare('font.size.code', 10)
13
- #prefs.declare('color.editline', "#d0e0ff")
14
-
15
5
  class LexerSquirrel(QsciLexerCustom):
16
6
  def __init__(self, parent = None):
17
7
  QsciLexerCustom.__init__(self, parent)
Widget/editor.py CHANGED
@@ -1,7 +1,8 @@
1
1
  from PyQt4.QtCore import SIGNAL
2
2
  from PyQt4.QtGui import QFontMetrics, QFont, QPixmap, QColor
3
- from PyQt4.Qsci import QsciScintilla, QsciLexerPython ,QsciAPIs
3
+ from PyQt4.Qsci import QsciScintilla, QsciLexerPython ,QsciAPIs ,QsciLexerCPP
4
4
  from globals import ospathjoin,workDir,fontSize,fontName
5
+ from LexerSquirrel import LexerSquirrel
5
6
 
6
7
 
7
8
  class Style:
@@ -18,14 +19,14 @@ class Style:
18
19
 
19
20
  class Editor(QsciScintilla):
20
21
  ARROW_MARKER_NUM = 8
21
- def __init__(self,parent,text,styleIndex = 0):
22
+ def __init__(self,parent,text,styleIndex = 0,lang = 0):
22
23
  QsciScintilla.__init__(self,parent)
23
24
  self.parent = parent
24
25
  self.styleIndex = styleIndex
26
+ self.lang = lang
25
27
  self.colorStyle = None
26
28
  self.init()
27
29
  self.setText(text)
28
-
29
30
  #self.addAction(QAction("gg",self))
30
31
  #self.findFirst("function",False,True,True,True)
31
32
  #self.setEdgeColumn(70)
@@ -38,17 +39,15 @@ class Editor(QsciScintilla):
38
39
  self.registerImage(0,QPixmap(":/Icons/class_obj.gif"))
39
40
  self.registerImage(1,QPixmap(":/Icons/method_obj.gif"))
40
41
  self.registerImage(2,QPixmap(":/Icons/field_public_obj.gif"))
41
-
42
42
  # Brace matching: enable for a brace immediately before or after
43
43
  # the current position
44
44
  self.setBraceMatching(QsciScintilla.SloppyBraceMatch)
45
- self.lexer = QsciLexerPython()
45
+
46
46
  #print ospathjoin(workDir,"emo.api")
47
47
  self.api = QsciAPIs(self.lexer)
48
48
  #api.load(ospathjoin(workDir,"emo.api"))
49
49
  self.code_complete()
50
50
  self.api.prepare()
51
- self.lexer.setDefaultFont(self.font)
52
51
  self.setLexer(self.lexer) #Very important do not change line otherwise gg
53
52
 
54
53
  self.setAutoCompletionThreshold(1)
@@ -62,10 +61,17 @@ class Editor(QsciScintilla):
62
61
  self.setFont(self.font)
63
62
  self.fontmetrics = QFontMetrics(self.font)
64
63
  self.setMarginsFont(self.font)
65
- self.setMarginWidth(0, self.fontmetrics.width("00000") + 6)
64
+ self.setMarginWidth(0, self.fontmetrics.width("000") + 6)
66
65
  # Margin 0 is used for line numbers
67
66
  self.setMarginLineNumbers(0, True)
68
67
  self.setCaretLineVisible(True)
68
+ if self.lang == 0:
69
+ self.lexer = QsciLexerPython()
70
+ elif self.lang == 1:
71
+ self.lexer = QsciLexerCPP()
72
+ elif self.lang == 2:
73
+ self.lexer = LexerSquirrel()
74
+ self.lexer.setDefaultFont(self.font)
69
75
 
70
76
 
71
77
  def setColorStyle(self,styleIndex):
Widget/editor.pyc CHANGED
Binary file
main.py CHANGED
@@ -6,8 +6,6 @@ __copyright__ = 'Copyright (c) 2012, pyros2097'
6
6
  __credits__ = ['pyros2097', 'eclipse']
7
7
  __email__ = 'pyros2097@gmail.com'
8
8
 
9
-
10
-
11
9
  #TODO:
12
10
  #Add options for all GUI
13
11
  #Add Project Options