summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/portato.cfg6
-rw-r--r--portato/gui/qt/terminal.py14
-rw-r--r--portato/gui/qt/windows.py24
-rw-r--r--portato/gui/templates/ui/PreferenceWindow.ui24
4 files changed, 58 insertions, 10 deletions
diff --git a/etc/portato.cfg b/etc/portato.cfg
index 63091b6..9d1c600 100644
--- a/etc/portato.cfg
+++ b/etc/portato.cfg
@@ -81,4 +81,10 @@ consolefont = Monospace 11
; control whether to show icons instead of checkboxes in the package list - boolean values
packageicons = off
+; sets the font of the console - string values
+consolefontfamily = Monospace
+
+; sets the size of the font in the console - string value
+consolefontsize = 11
+
# vim:ts=4:sw=4:ft=cfg
diff --git a/portato/gui/qt/terminal.py b/portato/gui/qt/terminal.py
index 51ca71b..91d2e94 100644
--- a/portato/gui/qt/terminal.py
+++ b/portato/gui/qt/terminal.py
@@ -108,9 +108,7 @@ class QtConsole (Console, Qt.QTextEdit):
self.formatQueue = Queue()
self.title = None
self.writeQueue = ""
- self.isOk = False
-
- self.setCurrentFont(Qt.QFont("Monospace",11))
+ self.isNotWrapping = False
# set black bg
self.palette().setColor(Qt.QPalette.Base, Qt.QColor("black"))
@@ -137,11 +135,11 @@ class QtConsole (Console, Qt.QTextEdit):
self.moveCursor(Qt.QTextCursor.StartOfLine, Qt.QTextCursor.KeepAnchor)
self.textCursor().removeSelectedText()
self.setLineWrapMode(Qt.QTextEdit.NoWrap)
- self.isOk = True
+ self.isNotWrapping = True
elif type == DeleteEvent.DEL_LINE_REVERT:
self.setLineWrapMode(Qt.QTextEdit.WidgetWidth)
- self.isOk = False
+ self.isNotWrapping = False
def event (self, event):
if event.type() == WriteEvent.TYPE:
@@ -167,7 +165,7 @@ class QtConsole (Console, Qt.QTextEdit):
if text == esc_seq[0]: # \x1b -> reload format
self.setCurrentCharFormat(self.get_format())
else:
- if not self.textCursor().atEnd() and not self.isOk: # move cursor and re-set format
+ if not self.textCursor().atEnd() and not self.isNotWrapping: # move cursor and re-set format
f = self.currentCharFormat()
self.moveCursor(Qt.QTextCursor.End)
self.setCurrentCharFormat(f)
@@ -176,7 +174,7 @@ class QtConsole (Console, Qt.QTextEdit):
self.insertPlainText(text)
# scroll down if needed
- if not self.isOk: self.ensureCursorVisible()
+ if not self.isNotWrapping: self.ensureCursorVisible()
def write(self, text):
"""Convenience function for emitting the writing signal."""
@@ -231,7 +229,7 @@ class QtConsole (Console, Qt.QTextEdit):
s = read(self.pty, 1)
if s == "": break # nothing read -> finish
- if self.isOk and s == "\n":
+ if self.isNotWrapping and s == "\n":
self.write(None)
Qt.QCoreApplication.postEvent(self, DeleteEvent(DeleteEvent.DEL_LINE_REVERT))
diff --git a/portato/gui/qt/windows.py b/portato/gui/qt/windows.py
index f3fcef6..abb69ad 100644
--- a/portato/gui/qt/windows.py
+++ b/portato/gui/qt/windows.py
@@ -280,6 +280,11 @@ class PreferenceWindow (Window):
_edit = self.__getattribute__(edit)
_edit.setText(self.cfg.get(self.edits[edit]))
+ # the font choser
+ self.consoleFontFam = self.cfg.get("consolefontfamily", "QT")
+ self.consoleFontSize = self.cfg.get("consolefontsize", "QT")
+ self.fontBtn.setText(self.consoleFontFam+" "+self.consoleFontSize)
+
Qt.QObject.connect(self, Qt.SIGNAL("accepted()"), self.finish)
def _save (self):
@@ -297,6 +302,9 @@ class PreferenceWindow (Window):
_edit = self.__getattribute__(edit)
self.cfg.set(self.edits[edit], _edit.text())
+ self.cfg.set("consolefontfamily", self.consoleFontFam, "QT")
+ self.cfg.set("consolefontsize", self.consoleFontSize, "QT")
+
def finish (self):
"""Saves and writes to config-file."""
self._save()
@@ -305,6 +313,14 @@ class PreferenceWindow (Window):
except IOError, e:
io_ex_dialog(self, e)
+ @Qt.pyqtSignature("")
+ def on_fontBtn_clicked(self):
+ font, ok = Qt.QFontDialog.getFont(Qt.QFont(self.consoleFontFam, int(self.consoleFontSize)), self, "Console Font")
+ if ok:
+ self.consoleFontFam = font.family()
+ self.consoleFontSize = str(font.pointSize())
+ self.fontBtn.setText(self.consoleFontFam+" "+self.consoleFontSize)
+
class PackageDetails:
"""The tab showing the details of a package."""
@@ -671,7 +687,7 @@ class MainWindow (Window):
# set plugins and plugin-menu
plugin.load_plugins("qt")
- menus = plugin.get_plugins().get_plugin_menus()
+ menus = plugin.get_plugin_queue().get_plugin_menus()
if menus:
self.pluginMenu = Qt.QMenu("&Plugins", self)
self.menubar.insertMenu(self.helpMenu.menuAction(), self.pluginMenu)
@@ -688,6 +704,7 @@ class MainWindow (Window):
# build console
self.console = QtConsole(self.consoleTab)
+ self.console.setCurrentFont(Qt.QFont(self.cfg.get("consolefontfamily", "QT"), int(self.cfg.get("consolefontsize", "QT"))))
self.consoleLayout = Qt.QVBoxLayout()
self.consoleLayout.setMargin(0)
self.consoleLayout.setSpacing(0)
@@ -788,7 +805,7 @@ class MainWindow (Window):
@Qt.pyqtSignature("")
def on_aboutAction_triggered (self):
- queue = plugin.get_plugins()
+ queue = plugin.get_plugin_queue()
if queue is None:
queue = []
else:
@@ -799,6 +816,9 @@ class MainWindow (Window):
@Qt.pyqtSignature("")
def on_prefAction_triggered (self):
PreferenceWindow(self, self.cfg).exec_()
+
+ # set font as it might has changed
+ self.console.setCurrentFont(Qt.QFont(self.cfg.get("consolefontfamily", "QT"), int(self.cfg.get("consolefontsize", "QT"))))
@Window.watch_cursor
@Qt.pyqtSignature("")
diff --git a/portato/gui/templates/ui/PreferenceWindow.ui b/portato/gui/templates/ui/PreferenceWindow.ui
index a7cf96f..38c6564 100644
--- a/portato/gui/templates/ui/PreferenceWindow.ui
+++ b/portato/gui/templates/ui/PreferenceWindow.ui
@@ -286,6 +286,30 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="" >
+ <property name="text" >
+ <string>Console Font:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="fontBtn" >
+ <property name="text" >
+ <string>PushButton</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>