Skip to content
Permalink
Browse files

[processing] allow changing font size in script editor

fixes #11328
  • Loading branch information
volaya committed Jun 30, 2015
1 parent de72874 commit 7d8e188e4d9c3b73cb797cc56ac94eab7e0f32b6
@@ -59,7 +59,7 @@ def setCommonOptions(self):
font = QFont()
font.setFamily('Courier')
font.setFixedPitch(True)
font.setPointSize(10)
font.setPointSize(20)
self.setFont(font)
self.setMarginsFont(font)

@@ -105,10 +105,14 @@ def setCommonOptions(self):
self.setAutoCompletionThreshold(2)
self.setAutoCompletionSource(QsciScintilla.AcsAPIs)

self.setFonts(10)

def setFonts(self, size):

# Load font from Python console settings
settings = QSettings()
fontName = settings.value('pythonConsole/fontfamilytext', 'Monospace')
fontSize = int(settings.value('pythonConsole/fontsize', 10))
fontSize = int(settings.value('pythonConsole/fontsize', size))

self.defaultFont = QFont(fontName)
self.defaultFont.setFixedPitch(True)
@@ -97,6 +97,8 @@ def __init__(self, algType, alg):
self.btnPaste.clicked.connect(self.editor.paste)
self.btnUndo.clicked.connect(self.editor.undo)
self.btnRedo.clicked.connect(self.editor.redo)
self.btnIncreaseFont.clicked.connect(self.increaseFontSize)
self.btnDecreaseFont.clicked.connect(self.decreaseFontSize)
self.editor.textChanged.connect(lambda: self.setHasChanged(True))

self.alg = alg
@@ -136,6 +138,16 @@ def __init__(self, algType, alg):

self.editor.setLexerType(self.algType)

def increaseFontSize(self):
font = self.editor.defaultFont
self.editor.setFonts(font.pointSize() + 1)
self.editor.initLexer()

def decreaseFontSize(self):
font = self.editor.defaultFont
self.editor.setFonts(font.pointSize() - 1)
self.editor.initLexer()

def showSnippets(self, evt):
popupmenu = QMenu()
for name, snippet in self.snippets.iteritems():
@@ -236,6 +236,33 @@
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnIncreaseFont">
<property name="text">
<string>A+</string>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnDecreaseFont">
<property name="text">
<string>A-</string>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">

0 comments on commit 7d8e188

Please sign in to comment.
You can’t perform that action at this time.