diff --git a/src/canvaspreviewframe.py b/src/canvaspreviewframe.py
index 4e87291..496e6a2 100644
--- a/src/canvaspreviewframe.py
+++ b/src/canvaspreviewframe.py
@@ -93,14 +93,21 @@ class CanvasPreviewFrame(QFrame):
max_width = self.view_rect[iWidth]/self.scale
max_height = self.view_rect[iHeight]/self.scale
- if (max_width > self.fake_width): max_width = self.fake_width
- if (max_height > self.fake_height): max_height = self.fake_height
- if (x < 0.0): x = 0.0
- elif (x > self.fake_width-max_width): x = self.fake_width-max_width
+ if (max_width > self.fake_width):
+ max_width = self.fake_width
+ if (max_height > self.fake_height):
+ max_height = self.fake_height
- if (y < 0.0): y = 0.0
- elif (y > self.fake_height-max_height): y = self.fake_height-max_height
+ if (x < 0.0):
+ x = 0.0
+ elif (x > self.fake_width-max_width):
+ x = self.fake_width-max_width
+
+ if (y < 0.0):
+ y = 0.0
+ elif (y > self.fake_height-max_height):
+ y = self.fake_height-max_height
self.view_rect[iX] = x+self.render_source.x()
self.view_rect[iY] = y+self.render_source.y()
@@ -110,19 +117,19 @@ class CanvasPreviewFrame(QFrame):
def mousePressEvent(self, event):
if (event.button() == Qt.LeftButton):
- self.m_mouseDown = True
- self.setCursor(QCursor(Qt.SizeAllCursor))
- self.handleMouseEvent(event.x(), event.y())
+ self.m_mouseDown = True
+ self.setCursor(QCursor(Qt.SizeAllCursor))
+ self.handleMouseEvent(event.x(), event.y())
event.accept()
def mouseMoveEvent(self, event):
if (self.m_mouseDown):
- self.handleMouseEvent(event.x(), event.y())
+ self.handleMouseEvent(event.x(), event.y())
event.accept()
def mouseReleaseEvent(self, event):
if (self.m_mouseDown):
- self.setCursor(QCursor(Qt.ArrowCursor))
+ self.setCursor(QCursor(Qt.ArrowCursor))
self.m_mouseDown = False
QFrame.mouseReleaseEvent(self, event)
@@ -136,8 +143,11 @@ class CanvasPreviewFrame(QFrame):
max_width = self.view_rect[iWidth]/self.scale
max_height = self.view_rect[iHeight]/self.scale
- if (max_width > self.fake_width): max_width = self.fake_width
- if (max_height > self.fake_height): max_height = self.fake_height
+
+ if (max_width > self.fake_width):
+ max_width = self.fake_width
+ if (max_height > self.fake_height):
+ max_height = self.fake_height
painter.setBrush(QBrush(QColor(75,75,255,30)))
painter.setPen(QPen(Qt.blue, 2))
@@ -148,5 +158,5 @@ class CanvasPreviewFrame(QFrame):
def resizeEvent(self, event):
self.render_source = self.getRenderSource()
if (self.real_parent):
- QTimer.singleShot(0, self.real_parent, SLOT("slot_miniCanvasCheckAll()"))
+ QTimer.singleShot(0, self.real_parent, SLOT("slot_miniCanvasCheckAll()"))
QFrame.resizeEvent(self, event)
diff --git a/src/logs.py b/src/logs.py
index 4881228..0a5f908 100755
--- a/src/logs.py
+++ b/src/logs.py
@@ -19,6 +19,7 @@
# Imports (Global)
from PyQt4.QtCore import pyqtSlot, Qt, QFile, QIODevice, QTextStream, QThread
from PyQt4.QtGui import QDialog, QPalette, QSyntaxHighlighter
+from time import sleep
# Imports (Custom Stuff)
import ui_logs
@@ -26,79 +27,79 @@ from shared import *
# Fix log text output (get rid of terminal colors stuff)
def fixLogText(text):
- return text.replace("[1m[31m","").replace("[1m[33m","").replace("[31m","").replace("[33m","").replace("[0m","")
+ return text.replace("[1m[31m", "").replace("[1m[33m", "").replace("[31m", "").replace("[33m", "").replace("[0m", "")
# Syntax Highlighter for JACK
-class SyntaxHighligher_JACK(QSyntaxHighlighter):
+class SyntaxHighlighter_JACK(QSyntaxHighlighter):
def __init__(self, parent):
QSyntaxHighlighter.__init__(self, parent)
self.m_palette = self.parent().palette()
def highlightBlock(self, text):
- if (": ERROR: " in text):
- self.setFormat(text.find(" ERROR: "), len(text), Qt.red)
- elif (": WARNING: " in text):
- self.setFormat(text.find(" WARNING: "), len(text), Qt.darkRed)
- elif (": ------------------" in text):
- self.setFormat(text.find(" ------------------"), len(text), self.m_palette.color(QPalette.Active, QPalette.Mid))
- elif (": Connecting " in text):
- self.setFormat(text.find(" Connecting "), len(text), self.m_palette.color(QPalette.Active, QPalette.Link))
- elif (": Disconnecting " in text):
- self.setFormat(text.find(" Disconnecting "), len(text), self.m_palette.color(QPalette.Active, QPalette.LinkVisited))
- #elif (": New client " in text):
- #self.setFormat(text.find(" New client "), len(text), self.m_palette.color(QPalette.Active, QPalette.Link))
+ if ": ERROR: " in text:
+ self.setFormat(text.find(" ERROR: "), len(text), Qt.red)
+ elif ": WARNING: " in text:
+ self.setFormat(text.find(" WARNING: "), len(text), Qt.darkRed)
+ elif ": ------------------" in text:
+ self.setFormat(text.find(" ------------------"), len(text), self.m_palette.color(QPalette.Active, QPalette.Mid))
+ elif ": Connecting " in text:
+ self.setFormat(text.find(" Connecting "), len(text), self.m_palette.color(QPalette.Active, QPalette.Link))
+ elif ": Disconnecting " in text:
+ self.setFormat(text.find(" Disconnecting "), len(text), self.m_palette.color(QPalette.Active, QPalette.LinkVisited))
+ #elif (": New client " in text):
+ #self.setFormat(text.find(" New client "), len(text), self.m_palette.color(QPalette.Active, QPalette.Link))
# Syntax Highlighter for A2J
-class SyntaxHighligher_A2J(QSyntaxHighlighter):
+class SyntaxHighlighter_A2J(QSyntaxHighlighter):
def __init__(self, parent):
QSyntaxHighlighter.__init__(self, parent)
self.m_palette = self.parent().palette()
def highlightBlock(self, text):
- if (": error: " in text):
- self.setFormat(text.find(" error: "), len(text), Qt.red)
- elif (": WARNING: " in text):
- self.setFormat(text.find(" WARNING: "), len(text), Qt.darkRed)
- elif (": ----------------------------" in text):
- self.setFormat(text.find("----------------------------"), len(text), self.m_palette.color(QPalette.Active, QPalette.Mid))
- elif (": port created: " in text):
- self.setFormat(text.find(" port created: "), len(text), self.m_palette.color(QPalette.Active, QPalette.Link))
- elif (": port deleted: " in text):
- self.setFormat(text.find(" port deleted: "), len(text), self.m_palette.color(QPalette.Active, QPalette.LinkVisited))
+ if ": error: " in text:
+ self.setFormat(text.find(" error: "), len(text), Qt.red)
+ elif ": WARNING: " in text:
+ self.setFormat(text.find(" WARNING: "), len(text), Qt.darkRed)
+ elif ": ----------------------------" in text:
+ self.setFormat(text.find("----------------------------"), len(text), self.m_palette.color(QPalette.Active, QPalette.Mid))
+ elif ": port created: " in text:
+ self.setFormat(text.find(" port created: "), len(text), self.m_palette.color(QPalette.Active, QPalette.Link))
+ elif ": port deleted: " in text:
+ self.setFormat(text.find(" port deleted: "), len(text), self.m_palette.color(QPalette.Active, QPalette.LinkVisited))
# Syntax Highlighter for LASH
-class SyntaxHighligher_LASH(QSyntaxHighlighter):
+class SyntaxHighlighter_LASH(QSyntaxHighlighter):
def __init__(self, parent):
QSyntaxHighlighter.__init__(self, parent)
self.m_palette = self.parent().palette()
def highlightBlock(self, text):
- if (": ERROR: " in text):
- self.setFormat(text.find(" ERROR: "), len(text), Qt.red)
- elif (": WARNING: " in text):
- self.setFormat(text.find(" WARNING: "), len(text), Qt.darkRed)
- elif (": ------------------" in text):
- self.setFormat(text.find(" ------------------"), len(text), self.m_palette.color(QPalette.Active, QPalette.Mid))
+ if ": ERROR: " in text:
+ self.setFormat(text.find(" ERROR: "), len(text), Qt.red)
+ elif ": WARNING: " in text:
+ self.setFormat(text.find(" WARNING: "), len(text), Qt.darkRed)
+ elif ": ------------------" in text:
+ self.setFormat(text.find(" ------------------"), len(text), self.m_palette.color(QPalette.Active, QPalette.Mid))
# Syntax Highlighter for LADISH
-class SyntaxHighligher_LADISH(QSyntaxHighlighter):
+class SyntaxHighlighter_LADISH(QSyntaxHighlighter):
def __init__(self, parent):
QSyntaxHighlighter.__init__(self, parent)
self.m_palette = self.parent().palette()
def highlightBlock(self, text):
- if (": ERROR: " in text):
- self.setFormat(text.find(" ERROR: "), len(text), Qt.red)
- elif (": WARNING: " in text):
- self.setFormat(text.find(" WARNING: "), len(text), Qt.darkRed)
- elif (": -------" in text):
- self.setFormat(text.find(" -------"), len(text), self.m_palette.color(QPalette.Active, QPalette.Mid))
-
-# Lockless file read thread
+ if ": ERROR: " in text:
+ self.setFormat(text.find(" ERROR: "), len(text), Qt.red)
+ elif ": WARNING: " in text:
+ self.setFormat(text.find(" WARNING: "), len(text), Qt.darkRed)
+ elif ": -------" in text:
+ self.setFormat(text.find(" -------"), len(text), self.m_palette.color(QPalette.Active, QPalette.Mid))
+
+# Lock-less file read thread
class LogsReadThread(QThread):
def __init__(self, parent):
QThread.__init__(self, parent)
@@ -116,29 +117,29 @@ class LogsReadThread(QThread):
# -------------------------------------------------------------
# Init logs
- if (self.LOG_FILE_JACK):
- self.log_jack_file = QFile(self.LOG_FILE_JACK)
- self.log_jack_file.open(QIODevice.ReadOnly)
- self.log_jack_stream = QTextStream(self.log_jack_file)
- self.log_jack_stream.setCodec("UTF-8")
-
- if (self.LOG_FILE_A2J):
- self.log_a2j_file = QFile(self.LOG_FILE_A2J)
- self.log_a2j_file.open(QIODevice.ReadOnly)
- self.log_a2j_stream = QTextStream(self.log_a2j_file)
- self.log_a2j_stream.setCodec("UTF-8")
-
- if (self.LOG_FILE_LASH):
- self.log_lash_file = QFile(self.LOG_FILE_LASH)
- self.log_lash_file.open(QIODevice.ReadOnly)
- self.log_lash_stream = QTextStream(self.log_lash_file)
- self.log_lash_stream.setCodec("UTF-8")
-
- if (self.LOG_FILE_LADISH):
- self.log_ladish_file = QFile(self.LOG_FILE_LADISH)
- self.log_ladish_file.open(QIODevice.ReadOnly)
- self.log_ladish_stream = QTextStream(self.log_ladish_file)
- self.log_ladish_stream.setCodec("UTF-8")
+ if self.LOG_FILE_JACK:
+ self.log_jack_file = QFile(self.LOG_FILE_JACK)
+ self.log_jack_file.open(QIODevice.ReadOnly)
+ self.log_jack_stream = QTextStream(self.log_jack_file)
+ self.log_jack_stream.setCodec("UTF-8")
+
+ if self.LOG_FILE_A2J:
+ self.log_a2j_file = QFile(self.LOG_FILE_A2J)
+ self.log_a2j_file.open(QIODevice.ReadOnly)
+ self.log_a2j_stream = QTextStream(self.log_a2j_file)
+ self.log_a2j_stream.setCodec("UTF-8")
+
+ if self.LOG_FILE_LASH:
+ self.log_lash_file = QFile(self.LOG_FILE_LASH)
+ self.log_lash_file.open(QIODevice.ReadOnly)
+ self.log_lash_stream = QTextStream(self.log_lash_file)
+ self.log_lash_stream.setCodec("UTF-8")
+
+ if self.LOG_FILE_LADISH:
+ self.log_ladish_file = QFile(self.LOG_FILE_LADISH)
+ self.log_ladish_file.open(QIODevice.ReadOnly)
+ self.log_ladish_stream = QTextStream(self.log_ladish_file)
+ self.log_ladish_stream.setCodec("UTF-8")
def purgeLogs(self):
self.m_purgeLogs = True
@@ -147,77 +148,76 @@ class LogsReadThread(QThread):
# -------------------------------------------------------------
# Read logs and set text in main thread
- while (self.isRunning()):
- if (self.m_purgeLogs):
- if (self.LOG_FILE_JACK):
- self.log_jack_stream.flush()
- self.log_jack_file.close()
- self.log_jack_file.open(QIODevice.WriteOnly)
- self.log_jack_file.close()
- self.log_jack_file.open(QIODevice.ReadOnly)
-
- if (self.LOG_FILE_A2J):
- self.log_a2j_stream.flush()
- self.log_a2j_file.close()
- self.log_a2j_file.open(QIODevice.WriteOnly)
- self.log_a2j_file.close()
- self.log_a2j_file.open(QIODevice.ReadOnly)
-
- if (self.LOG_FILE_LASH):
- self.log_lash_stream.flush()
- self.log_lash_file.close()
- self.log_lash_file.open(QIODevice.WriteOnly)
- self.log_lash_file.close()
- self.log_lash_file.open(QIODevice.ReadOnly)
-
- if (self.LOG_FILE_LADISH):
- self.log_ladish_stream.flush()
- self.log_ladish_file.close()
- self.log_ladish_file.open(QIODevice.WriteOnly)
- self.log_ladish_file.close()
- self.log_ladish_file.open(QIODevice.ReadOnly)
-
- else:
- text_jack = ""
- text_a2j = ""
- text_lash = ""
- text_ladish = ""
-
- if (self.LOG_FILE_JACK):
- text_jack = fixLogText(self.log_jack_stream.readAll()).strip()
-
- if (self.LOG_FILE_A2J):
- text_a2j = fixLogText(self.log_a2j_stream.readAll()).strip()
-
- if (self.LOG_FILE_LASH):
- text_lash = fixLogText(self.log_lash_stream.readAll()).strip()
-
- if (self.LOG_FILE_LADISH):
- text_ladish = fixLogText(self.log_ladish_stream.readAll()).strip()
-
- self.parent().setLogsText(text_jack, text_a2j, text_lash, text_ladish)
- self.emit(SIGNAL("updateLogs()"))
-
- self.sleep(1)
+ while self.isRunning():
+ if self.m_purgeLogs:
+ if self.LOG_FILE_JACK:
+ self.log_jack_stream.flush()
+ self.log_jack_file.close()
+ self.log_jack_file.open(QIODevice.WriteOnly)
+ self.log_jack_file.close()
+ self.log_jack_file.open(QIODevice.ReadOnly)
+
+ if self.LOG_FILE_A2J:
+ self.log_a2j_stream.flush()
+ self.log_a2j_file.close()
+ self.log_a2j_file.open(QIODevice.WriteOnly)
+ self.log_a2j_file.close()
+ self.log_a2j_file.open(QIODevice.ReadOnly)
+
+ if self.LOG_FILE_LASH:
+ self.log_lash_stream.flush()
+ self.log_lash_file.close()
+ self.log_lash_file.open(QIODevice.WriteOnly)
+ self.log_lash_file.close()
+ self.log_lash_file.open(QIODevice.ReadOnly)
+
+ if self.LOG_FILE_LADISH:
+ self.log_ladish_stream.flush()
+ self.log_ladish_file.close()
+ self.log_ladish_file.open(QIODevice.WriteOnly)
+ self.log_ladish_file.close()
+ self.log_ladish_file.open(QIODevice.ReadOnly)
+
+ else:
+ text_jack = ""
+ text_a2j = ""
+ text_lash = ""
+ text_ladish = ""
+
+ if self.LOG_FILE_JACK:
+ text_jack = fixLogText(self.log_jack_stream.readAll()).strip()
+
+ if self.LOG_FILE_A2J:
+ text_a2j = fixLogText(self.log_a2j_stream.readAll()).strip()
+
+ if self.LOG_FILE_LASH:
+ text_lash = fixLogText(self.log_lash_stream.readAll()).strip()
+
+ if self.LOG_FILE_LADISH:
+ text_ladish = fixLogText(self.log_ladish_stream.readAll()).strip()
+
+ self.parent().setLogsText(text_jack, text_a2j, text_lash, text_ladish)
+ self.emit(SIGNAL("updateLogs()"))
+
+ self.sleep(1)
# -------------------------------------------------------------
# Close logs before closing thread
- if (self.LOG_FILE_JACK):
- self.log_jack_file.close()
+ if self.LOG_FILE_JACK:
+ self.log_jack_file.close()
- if (self.LOG_FILE_A2J):
- self.log_a2j_file.close()
+ if self.LOG_FILE_A2J:
+ self.log_a2j_file.close()
- if (self.LOG_FILE_LASH):
- self.log_lash_file.close()
+ if self.LOG_FILE_LASH:
+ self.log_lash_file.close()
- if (self.LOG_FILE_LADISH):
- self.log_ladish_file.close()
+ if self.LOG_FILE_LADISH:
+ self.log_ladish_file.close()
# Logs Window
class LogsW(QDialog, ui_logs.Ui_LogsW):
-
LOG_PATH = os.path.join(HOME, ".log")
LOG_FILE_JACK = os.path.join(LOG_PATH, "jack", "jackdbus.log")
@@ -233,54 +233,56 @@ class LogsW(QDialog, ui_logs.Ui_LogsW):
self.b_purge.setIcon(getIcon("user-trash"))
self.m_firstRun = True
+ self.m_textLock = False
+
self.m_text_jack = ""
self.m_text_a2j = ""
self.m_text_lash = ""
self.m_text_ladish = ""
# -------------------------------------------------------------
- # Check for unexisting logs and remove tabs for those
+ # Check for non-existing logs and remove tabs for those
tab_index = 0
- if (not os.path.exists(self.LOG_FILE_JACK)):
- self.LOG_FILE_JACK = None
- self.tabWidget.removeTab(0-tab_index)
- tab_index += 1
+ if not os.path.exists(self.LOG_FILE_JACK):
+ self.LOG_FILE_JACK = None
+ self.tabWidget.removeTab(0 - tab_index)
+ tab_index += 1
- if (not os.path.exists(self.LOG_FILE_A2J)):
- self.LOG_FILE_A2J = None
- self.tabWidget.removeTab(1-tab_index)
- tab_index += 1
+ if not os.path.exists(self.LOG_FILE_A2J):
+ self.LOG_FILE_A2J = None
+ self.tabWidget.removeTab(1 - tab_index)
+ tab_index += 1
- if (not os.path.exists(self.LOG_FILE_LASH)):
- self.LOG_FILE_LASH = None
- self.tabWidget.removeTab(2-tab_index)
- tab_index += 1
+ if not os.path.exists(self.LOG_FILE_LASH):
+ self.LOG_FILE_LASH = None
+ self.tabWidget.removeTab(2 - tab_index)
+ tab_index += 1
- if (not os.path.exists(self.LOG_FILE_LADISH)):
- self.LOG_FILE_LADISH = None
- self.tabWidget.removeTab(3-tab_index)
- tab_index += 1
+ if not os.path.exists(self.LOG_FILE_LADISH):
+ self.LOG_FILE_LADISH = None
+ self.tabWidget.removeTab(3 - tab_index)
+ tab_index += 1
# -------------------------------------------------------------
# Init logs viewers
- if (self.LOG_FILE_JACK):
- syntax_jack = SyntaxHighligher_JACK(self.pte_jack)
- syntax_jack.setDocument(self.pte_jack.document())
+ if self.LOG_FILE_JACK:
+ syntax_jack = SyntaxHighlighter_JACK(self.pte_jack)
+ syntax_jack.setDocument(self.pte_jack.document())
- if (self.LOG_FILE_A2J):
- syntax_a2j = SyntaxHighligher_A2J(self.pte_a2j)
- syntax_a2j.setDocument(self.pte_a2j.document())
+ if self.LOG_FILE_A2J:
+ syntax_a2j = SyntaxHighlighter_A2J(self.pte_a2j)
+ syntax_a2j.setDocument(self.pte_a2j.document())
- if (self.LOG_FILE_LASH):
- syntax_lash = SyntaxHighligher_LASH(self.pte_lash)
- syntax_lash.setDocument(self.pte_lash.document())
+ if self.LOG_FILE_LASH:
+ syntax_lash = SyntaxHighlighter_LASH(self.pte_lash)
+ syntax_lash.setDocument(self.pte_lash.document())
- if (self.LOG_FILE_LADISH):
- syntax_ladish = SyntaxHighligher_LADISH(self.pte_ladish)
- syntax_ladish.setDocument(self.pte_ladish.document())
+ if self.LOG_FILE_LADISH:
+ syntax_ladish = SyntaxHighlighter_LADISH(self.pte_ladish)
+ syntax_ladish.setDocument(self.pte_ladish.document())
# -------------------------------------------------------------
# Init file read thread
@@ -295,6 +297,9 @@ class LogsW(QDialog, ui_logs.Ui_LogsW):
self.connect(self.m_readThread, SIGNAL("updateLogs()"), SLOT("slot_updateLogs()"))
def setLogsText(self, text_jack, text_a2j, text_lash, text_ladish):
+ while self.m_textLock:
+ sleep(0.5)
+
self.m_text_jack = text_jack
self.m_text_a2j = text_a2j
self.m_text_lash = text_lash
@@ -302,40 +307,38 @@ class LogsW(QDialog, ui_logs.Ui_LogsW):
@pyqtSlot()
def slot_updateLogs(self):
- if (self.m_firstRun):
- self.pte_jack.clear()
- self.pte_a2j.clear()
- self.pte_lash.clear()
- self.pte_ladish.clear()
-
- if (self.LOG_FILE_A2J):
- if (self.m_text_a2j):
+ self.m_textLock = True
+
+ if self.m_firstRun:
+ self.pte_jack.clear()
+ self.pte_a2j.clear()
+ self.pte_lash.clear()
+ self.pte_ladish.clear()
+
+ if self.LOG_FILE_JACK and self.m_text_jack:
+ self.pte_jack.appendPlainText(self.m_text_jack)
+
+ if self.LOG_FILE_A2J and self.m_text_a2j:
self.pte_a2j.appendPlainText(self.m_text_a2j)
- if (self.LOG_FILE_LASH):
- if (self.m_text_lash):
+ if self.LOG_FILE_LASH and self.m_text_lash:
self.pte_lash.appendPlainText(self.m_text_lash)
- if (self.LOG_FILE_LADISH):
- if (self.m_text_ladish):
+ if self.LOG_FILE_LADISH and self.m_text_ladish:
self.pte_ladish.appendPlainText(self.m_text_ladish)
- # Somehow appending the whole jack log breaks this call?
- # Set it here in last for now
- if (self.LOG_FILE_JACK):
- if (self.m_text_jack):
- self.pte_jack.appendPlainText(self.m_text_jack)
+ if self.m_firstRun:
+ self.pte_jack.horizontalScrollBar().setValue(0)
+ self.pte_jack.verticalScrollBar().setValue(self.pte_jack.verticalScrollBar().maximum())
+ self.pte_a2j.horizontalScrollBar().setValue(0)
+ self.pte_a2j.verticalScrollBar().setValue(self.pte_a2j.verticalScrollBar().maximum())
+ self.pte_lash.horizontalScrollBar().setValue(0)
+ self.pte_lash.verticalScrollBar().setValue(self.pte_lash.verticalScrollBar().maximum())
+ self.pte_ladish.horizontalScrollBar().setValue(0)
+ self.pte_ladish.verticalScrollBar().setValue(self.pte_ladish.verticalScrollBar().maximum())
+ self.m_firstRun = False
- if (self.m_firstRun):
- self.pte_jack.horizontalScrollBar().setValue(0)
- self.pte_jack.verticalScrollBar().setValue(self.pte_jack.verticalScrollBar().maximum())
- self.pte_a2j.horizontalScrollBar().setValue(0)
- self.pte_a2j.verticalScrollBar().setValue(self.pte_a2j.verticalScrollBar().maximum())
- self.pte_lash.horizontalScrollBar().setValue(0)
- self.pte_lash.verticalScrollBar().setValue(self.pte_lash.verticalScrollBar().maximum())
- self.pte_ladish.horizontalScrollBar().setValue(0)
- self.pte_ladish.verticalScrollBar().setValue(self.pte_ladish.verticalScrollBar().maximum())
- self.m_firstRun = False
+ self.m_textLock = False
@pyqtSlot()
def slot_purgeLogs(self):
@@ -356,7 +359,6 @@ class LogsW(QDialog, ui_logs.Ui_LogsW):
# -------------------------------------------------------------
# Allow to use this as a standalone app
if __name__ == '__main__':
-
# Additional imports
from PyQt4.QtGui import QApplication
diff --git a/src/shared_canvas.py b/src/shared_canvas.py
index 0e989d9..753759c 100644
--- a/src/shared_canvas.py
+++ b/src/shared_canvas.py
@@ -23,6 +23,8 @@ from PyQt4.QtGui import QFileDialog, QImage, QPainter, QPrinter, QPrintDialog
# Imports (Custom Stuff)
import patchcanvas
+# ------------------------------------------------------------------------------------------------------------
+
# Shared Canvas code
def canvas_arrange():
patchcanvas.arrange()
@@ -47,46 +49,49 @@ def canvas_print(self_):
self_.scene.clearSelection()
self_.m_export_printer = QPrinter()
dialog = QPrintDialog(self_.m_export_printer, self_)
+
if (dialog.exec_()):
- painter = QPainter(self_.m_export_printer)
- painter.setRenderHint(QPainter.Antialiasing)
- painter.setRenderHint(QPainter.TextAntialiasing)
- self_.scene.render(painter)
+ painter = QPainter(self_.m_export_printer)
+ painter.setRenderHint(QPainter.Antialiasing)
+ painter.setRenderHint(QPainter.TextAntialiasing)
+ self_.scene.render(painter)
def canvas_save_image(self_):
newPath = QFileDialog.getSaveFileName(self_, self_.tr("Save Image"), filter=self_.tr("PNG Image (*.png);;JPEG Image (*.jpg)"))
- print(newPath)
if (newPath):
- self_.scene.clearSelection()
- if (newPath.endswith((".jpg", ".jpG", ".jPG", ".JPG", ".JPg", ".Jpg"))):
- img_format = "JPG"
- elif (newPath.endswith((".png", ".pnG", ".pNG", ".PNG", ".PNg", ".Png"))):
- img_format = "PNG"
- else:
- # File-dialog may not auto-add the extension
- img_format = "PNG"
- newPath += ".png"
-
- self_.m_export_image = QImage(self_.scene.sceneRect().width(), self_.scene.sceneRect().height(), QImage.Format_RGB32)
- painter = QPainter(self_.m_export_image)
- painter.setRenderHint(QPainter.Antialiasing)
- painter.setRenderHint(QPainter.TextAntialiasing)
- self_.scene.render(painter)
- self_.m_export_image.save(newPath, img_format, 100)
+ self_.scene.clearSelection()
+
+ if (newPath.endswith((".jpg", ".jpG", ".jPG", ".JPG", ".JPg", ".Jpg"))):
+ img_format = "JPG"
+ elif (newPath.endswith((".png", ".pnG", ".pNG", ".PNG", ".PNg", ".Png"))):
+ img_format = "PNG"
+ else:
+ # File-dialog may not auto-add the extension
+ img_format = "PNG"
+ newPath += ".png"
+
+ self_.m_export_image = QImage(self_.scene.sceneRect().width(), self_.scene.sceneRect().height(), QImage.Format_RGB32)
+ painter = QPainter(self_.m_export_image)
+ painter.setRenderHint(QPainter.Antialiasing) # TODO - set true, cleanup this
+ painter.setRenderHint(QPainter.TextAntialiasing)
+ self_.scene.render(painter)
+ self_.m_export_image.save(newPath, img_format, 100)
+
+# ------------------------------------------------------------------------------------------------------------
# Shared Connections
def setCanvasConnections(self_):
- self_.act_canvas_arrange.setEnabled(False)
- self_.connect(self_.act_canvas_arrange, SIGNAL("triggered()"), lambda: canvas_arrange())
- self_.connect(self_.act_canvas_refresh, SIGNAL("triggered()"), lambda: canvas_refresh(self_))
- self_.connect(self_.act_canvas_zoom_fit, SIGNAL("triggered()"), lambda: canvas_zoom_fit(self_))
- self_.connect(self_.act_canvas_zoom_in, SIGNAL("triggered()"), lambda: canvas_zoom_in(self_))
- self_.connect(self_.act_canvas_zoom_out, SIGNAL("triggered()"), lambda: canvas_zoom_out(self_))
- self_.connect(self_.act_canvas_zoom_100, SIGNAL("triggered()"), lambda: canvas_zoom_reset(self_))
- self_.connect(self_.act_canvas_print, SIGNAL("triggered()"), lambda: canvas_print(self_))
- self_.connect(self_.act_canvas_save_image, SIGNAL("triggered()"), lambda: canvas_save_image(self_))
- self_.connect(self_.b_canvas_zoom_fit, SIGNAL("clicked()"), lambda: canvas_zoom_fit(self_))
- self_.connect(self_.b_canvas_zoom_in, SIGNAL("clicked()"), lambda: canvas_zoom_in(self_))
- self_.connect(self_.b_canvas_zoom_out, SIGNAL("clicked()"), lambda: canvas_zoom_out(self_))
- self_.connect(self_.b_canvas_zoom_100, SIGNAL("clicked()"), lambda: canvas_zoom_reset(self_))
+ self_.act_canvas_arrange.setEnabled(False) # TODO - later
+ self_.connect(self_.act_canvas_arrange, SIGNAL("triggered()"), lambda: canvas_arrange())
+ self_.connect(self_.act_canvas_refresh, SIGNAL("triggered()"), lambda: canvas_refresh(self_))
+ self_.connect(self_.act_canvas_zoom_fit, SIGNAL("triggered()"), lambda: canvas_zoom_fit(self_))
+ self_.connect(self_.act_canvas_zoom_in, SIGNAL("triggered()"), lambda: canvas_zoom_in(self_))
+ self_.connect(self_.act_canvas_zoom_out, SIGNAL("triggered()"), lambda: canvas_zoom_out(self_))
+ self_.connect(self_.act_canvas_zoom_100, SIGNAL("triggered()"), lambda: canvas_zoom_reset(self_))
+ self_.connect(self_.act_canvas_print, SIGNAL("triggered()"), lambda: canvas_print(self_))
+ self_.connect(self_.act_canvas_save_image, SIGNAL("triggered()"), lambda: canvas_save_image(self_))
+ self_.connect(self_.b_canvas_zoom_fit, SIGNAL("clicked()"), lambda: canvas_zoom_fit(self_))
+ self_.connect(self_.b_canvas_zoom_in, SIGNAL("clicked()"), lambda: canvas_zoom_in(self_))
+ self_.connect(self_.b_canvas_zoom_out, SIGNAL("clicked()"), lambda: canvas_zoom_out(self_))
+ self_.connect(self_.b_canvas_zoom_100, SIGNAL("clicked()"), lambda: canvas_zoom_reset(self_))
diff --git a/src/shared_settings.py b/src/shared_settings.py
index 775e9b2..16c4dac 100644
--- a/src/shared_settings.py
+++ b/src/shared_settings.py
@@ -16,11 +16,6 @@
#
# For a full copy of the GNU General Public License see the COPYING file
-# Set PyQt4 API
-from sip import setapi
-setapi("QString", 2)
-setapi("QVariant", 2)
-
# Imports (Global)
from PyQt4.QtCore import pyqtSlot, SIGNAL, SLOT
from PyQt4.QtGui import QDialog, QDialogButtonBox, QIcon, QPixmap
diff --git a/src/ui/logs.ui b/src/ui/logs.ui
index 5d4aa5b..34a3c76 100644
--- a/src/ui/logs.ui
+++ b/src/ui/logs.ui
@@ -29,6 +29,9 @@
Qt::ScrollBarAlwaysOn
+
+ Qt::ScrollBarAlwaysOn
+
QPlainTextEdit::NoWrap
@@ -52,6 +55,9 @@
Qt::ScrollBarAlwaysOn
+
+ Qt::ScrollBarAlwaysOn
+
QPlainTextEdit::NoWrap
@@ -75,6 +81,9 @@
Qt::ScrollBarAlwaysOn
+
+ Qt::ScrollBarAlwaysOn
+
QPlainTextEdit::NoWrap
@@ -98,6 +107,9 @@
Qt::ScrollBarAlwaysOn
+
+ Qt::ScrollBarAlwaysOn
+
QPlainTextEdit::NoWrap