author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Tue, 22 Mar 2022 14:50:46 +0100 | |
branch | wxPython4 |
changeset 3442 | 29dbdb09da2e |
parent 3303 | 0ffb41625592 |
child 3575 | cbf99c4122bd |
permissions | -rw-r--r-- |
978 | 1 |
#!/usr/bin/env python |
2 |
# -*- coding: utf-8 -*- |
|
3 |
||
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1441
diff
changeset
|
4 |
# This file is part of Beremiz, a Integrated Development Environment for |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1441
diff
changeset
|
5 |
# programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
978 | 6 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1441
diff
changeset
|
7 |
# Copyright (C) 2013: Edouard TISSERANT and Laurent BESSARD |
978 | 8 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1441
diff
changeset
|
9 |
# See COPYING file for copyrights details. |
978 | 10 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1441
diff
changeset
|
11 |
# This program is free software; you can redistribute it and/or |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1441
diff
changeset
|
12 |
# modify it under the terms of the GNU General Public License |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1441
diff
changeset
|
13 |
# as published by the Free Software Foundation; either version 2 |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1441
diff
changeset
|
14 |
# of the License, or (at your option) any later version. |
978 | 15 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1441
diff
changeset
|
16 |
# This program is distributed in the hope that it will be useful, |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1441
diff
changeset
|
17 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1441
diff
changeset
|
18 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1441
diff
changeset
|
19 |
# GNU General Public License for more details. |
978 | 20 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1441
diff
changeset
|
21 |
# You should have received a copy of the GNU General Public License |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1441
diff
changeset
|
22 |
# along with this program; if not, write to the Free Software |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1441
diff
changeset
|
23 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1441
diff
changeset
|
24 |
|
978 | 25 |
|
1881
091005ec69c4
fix pylint py3k conversion warning: "(no-absolute-import) import missing `from __future__ import absolute_import`"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1878
diff
changeset
|
26 |
from __future__ import absolute_import |
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2432
diff
changeset
|
27 |
from __future__ import division |
978 | 28 |
from datetime import datetime |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
29 |
from time import time as gettime |
1832
0f1081928d65
fix wrong-import-order. first standard modules are imported, then others
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1831
diff
changeset
|
30 |
from weakref import proxy |
0f1081928d65
fix wrong-import-order. first standard modules are imported, then others
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1831
diff
changeset
|
31 |
|
982
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
32 |
import numpy |
978 | 33 |
import wx |
2432
dbc065a2f7a5
python3 support: pylint, W1613 # (xrange-builtin) xrange built-in referenced
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1989
diff
changeset
|
34 |
from six.moves import xrange |
978 | 35 |
|
1169
53e4a2b775a7
Move CustomToolTip from GraphicCommons to controls
Laurent Bessard
parents:
1094
diff
changeset
|
36 |
from controls.CustomToolTip import CustomToolTip, TOOLTIP_WAIT_PERIOD |
1176
f4b434672204
Moved and rewrote DebugViewer and DebusDataConsumer classes
Laurent Bessard
parents:
1170
diff
changeset
|
37 |
from editors.DebugViewer import DebugViewer, REFRESH_PERIOD |
1902
2b7e2db31d81
Clarify licensing, and packaging of runtime only files :
Edouard Tisserant
parents:
1881
diff
changeset
|
38 |
from runtime.loglevels import LogLevelsCount, LogLevels |
978 | 39 |
from util.BitmapLibrary import GetBitmap |
1832
0f1081928d65
fix wrong-import-order. first standard modules are imported, then others
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1831
diff
changeset
|
40 |
|
978 | 41 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
42 |
THUMB_SIZE_RATIO = 1. / 8. |
978 | 43 |
|
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1735
diff
changeset
|
44 |
|
993 | 45 |
def ArrowPoints(direction, width, height, xoffset, yoffset): |
986 | 46 |
if direction == wx.TOP: |
993 | 47 |
return [wx.Point(xoffset + 1, yoffset + height - 2), |
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2432
diff
changeset
|
48 |
wx.Point(xoffset + width // 2, yoffset + 1), |
993 | 49 |
wx.Point(xoffset + width - 1, yoffset + height - 2)] |
986 | 50 |
else: |
993 | 51 |
return [wx.Point(xoffset + 1, yoffset - height + 1), |
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2432
diff
changeset
|
52 |
wx.Point(xoffset + width // 2, yoffset - 2), |
993 | 53 |
wx.Point(xoffset + width - 1, yoffset - height + 1)] |
986 | 54 |
|
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1735
diff
changeset
|
55 |
|
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
56 |
class LogScrollBar(wx.Panel): |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
57 |
|
978 | 58 |
def __init__(self, parent, size): |
59 |
wx.Panel.__init__(self, parent, size=size) |
|
60 |
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) |
|
61 |
self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp) |
|
62 |
self.Bind(wx.EVT_MOTION, self.OnMotion) |
|
988
30e7571c10d0
Reduced flicker on LogViewer and DebugGraphPanel on Windows
Laurent Bessard
parents:
987
diff
changeset
|
63 |
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) |
978 | 64 |
self.Bind(wx.EVT_PAINT, self.OnPaint) |
65 |
self.Bind(wx.EVT_SIZE, self.OnResize) |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
66 |
|
1737
a39c2918c015
clean-up: fix PEP8 E261 at least two spaces before inline comment
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
67 |
self.ThumbPosition = 0. # -1 <= ThumbPosition <= 1 |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
68 |
self.ThumbScrollingStartPos = None |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
69 |
|
978 | 70 |
def GetRangeRect(self): |
71 |
width, height = self.GetClientSize() |
|
72 |
return wx.Rect(0, width, width, height - 2 * width) |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
73 |
|
978 | 74 |
def GetThumbRect(self): |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
75 |
width, _height = self.GetClientSize() |
978 | 76 |
range_rect = self.GetRangeRect() |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
77 |
thumb_size = range_rect.height * THUMB_SIZE_RATIO |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
78 |
thumb_range = range_rect.height - thumb_size |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
79 |
thumb_center_position = (thumb_size + (self.ThumbPosition + 1) * thumb_range) / 2. |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
80 |
thumb_start = int(thumb_center_position - thumb_size / 2.) |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
81 |
thumb_end = int(thumb_center_position + thumb_size / 2.) |
987
7ca88194ae89
Improved graphics of LogViewer scrollbar to be anti-aliased
Laurent Bessard
parents:
986
diff
changeset
|
82 |
return wx.Rect(0, range_rect.y + thumb_start, width, thumb_end - thumb_start) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
83 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
84 |
def RefreshThumbPosition(self, thumb_position=None): |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
85 |
if thumb_position is None: |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
86 |
thumb_position = self.ThumbPosition |
978 | 87 |
if self.Parent.IsMessagePanelTop(): |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
88 |
thumb_position = max(0., thumb_position) |
978 | 89 |
if self.Parent.IsMessagePanelBottom(): |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
90 |
thumb_position = min(0., thumb_position) |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
91 |
if thumb_position != self.ThumbPosition: |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
92 |
self.ThumbPosition = thumb_position |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
93 |
self.Parent.SetScrollSpeed(self.ThumbPosition) |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
94 |
self.Refresh() |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
95 |
|
978 | 96 |
def OnLeftDown(self, event): |
97 |
self.CaptureMouse() |
|
98 |
posx, posy = event.GetPosition() |
|
99 |
width, height = self.GetClientSize() |
|
100 |
range_rect = self.GetRangeRect() |
|
101 |
thumb_rect = self.GetThumbRect() |
|
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2737
diff
changeset
|
102 |
if range_rect.Contains(posx, posy): |
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2737
diff
changeset
|
103 |
if thumb_rect.Contains(posx, posy): |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
104 |
self.ThumbScrollingStartPos = wx.Point(posx, posy) |
978 | 105 |
elif posy < thumb_rect.y: |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
106 |
self.Parent.ScrollToLast() |
978 | 107 |
elif posy > thumb_rect.y + thumb_rect.height: |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
108 |
self.Parent.ScrollToFirst() |
978 | 109 |
elif posy < width: |
986 | 110 |
self.Parent.ScrollMessagePanelByPage(1) |
978 | 111 |
elif posy > height - width: |
986 | 112 |
self.Parent.ScrollMessagePanelByPage(-1) |
978 | 113 |
event.Skip() |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
114 |
|
978 | 115 |
def OnLeftUp(self, event): |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
116 |
self.ThumbScrollingStartPos = None |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
117 |
self.RefreshThumbPosition(0.) |
978 | 118 |
if self.HasCapture(): |
119 |
self.ReleaseMouse() |
|
120 |
event.Skip() |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
121 |
|
978 | 122 |
def OnMotion(self, event): |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
123 |
if event.Dragging() and self.ThumbScrollingStartPos is not None: |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
124 |
_posx, posy = event.GetPosition() |
978 | 125 |
range_rect = self.GetRangeRect() |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
126 |
thumb_size = range_rect.height * THUMB_SIZE_RATIO |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
127 |
thumb_range = range_rect.height - thumb_size |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
128 |
self.RefreshThumbPosition( |
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2432
diff
changeset
|
129 |
max(-1., min((posy - self.ThumbScrollingStartPos.y) * 2. // thumb_range, 1.))) |
978 | 130 |
event.Skip() |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
131 |
|
978 | 132 |
def OnResize(self, event): |
133 |
self.Refresh() |
|
134 |
event.Skip() |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
135 |
|
988
30e7571c10d0
Reduced flicker on LogViewer and DebugGraphPanel on Windows
Laurent Bessard
parents:
987
diff
changeset
|
136 |
def OnEraseBackground(self, event): |
30e7571c10d0
Reduced flicker on LogViewer and DebugGraphPanel on Windows
Laurent Bessard
parents:
987
diff
changeset
|
137 |
pass |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
138 |
|
978 | 139 |
def OnPaint(self, event): |
140 |
dc = wx.BufferedPaintDC(self) |
|
141 |
dc.Clear() |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
142 |
|
987
7ca88194ae89
Improved graphics of LogViewer scrollbar to be anti-aliased
Laurent Bessard
parents:
986
diff
changeset
|
143 |
gc = wx.GCDC(dc) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
144 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
145 |
width, height = self.GetClientSize() |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
146 |
|
993 | 147 |
gc.SetPen(wx.Pen(wx.NamedColour("GREY"), 3)) |
987
7ca88194ae89
Improved graphics of LogViewer scrollbar to be anti-aliased
Laurent Bessard
parents:
986
diff
changeset
|
148 |
gc.SetBrush(wx.GREY_BRUSH) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
149 |
|
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2432
diff
changeset
|
150 |
gc.DrawLines(ArrowPoints(wx.TOP, width * 0.75, width * 0.5, 2, (width + height) // 4 - 3)) |
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2432
diff
changeset
|
151 |
gc.DrawLines(ArrowPoints(wx.TOP, width * 0.75, width * 0.5, 2, (width + height) // 4 + 3)) |
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2432
diff
changeset
|
152 |
|
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2432
diff
changeset
|
153 |
gc.DrawLines(ArrowPoints(wx.BOTTOM, width * 0.75, width * 0.5, 2, (height * 3 - width) // 4 + 3)) |
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2432
diff
changeset
|
154 |
gc.DrawLines(ArrowPoints(wx.BOTTOM, width * 0.75, width * 0.5, 2, (height * 3 - width) // 4 - 3)) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
155 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
156 |
thumb_rect = self.GetThumbRect() |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
157 |
exclusion_rect = wx.Rect(thumb_rect.x, thumb_rect.y, |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
158 |
thumb_rect.width, thumb_rect.height) |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
159 |
if self.Parent.IsMessagePanelTop(): |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
160 |
exclusion_rect.y, exclusion_rect.height = width, exclusion_rect.y + exclusion_rect.height - width |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
161 |
if self.Parent.IsMessagePanelBottom(): |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
162 |
exclusion_rect.height = height - width - exclusion_rect.y |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
163 |
if exclusion_rect != thumb_rect: |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
164 |
colour = wx.NamedColour("LIGHT GREY") |
987
7ca88194ae89
Improved graphics of LogViewer scrollbar to be anti-aliased
Laurent Bessard
parents:
986
diff
changeset
|
165 |
gc.SetPen(wx.Pen(colour)) |
7ca88194ae89
Improved graphics of LogViewer scrollbar to be anti-aliased
Laurent Bessard
parents:
986
diff
changeset
|
166 |
gc.SetBrush(wx.Brush(colour)) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
167 |
|
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
168 |
gc.DrawRectangle(exclusion_rect.x, exclusion_rect.y, |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
169 |
exclusion_rect.width, exclusion_rect.height) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
170 |
|
987
7ca88194ae89
Improved graphics of LogViewer scrollbar to be anti-aliased
Laurent Bessard
parents:
986
diff
changeset
|
171 |
gc.SetPen(wx.GREY_PEN) |
7ca88194ae89
Improved graphics of LogViewer scrollbar to be anti-aliased
Laurent Bessard
parents:
986
diff
changeset
|
172 |
gc.SetBrush(wx.GREY_BRUSH) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
173 |
|
993 | 174 |
gc.DrawPolygon(ArrowPoints(wx.TOP, width, width, 0, 0)) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
175 |
|
993 | 176 |
gc.DrawPolygon(ArrowPoints(wx.BOTTOM, width, width, 0, height)) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
177 |
|
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
178 |
gc.DrawRectangle(thumb_rect.x, thumb_rect.y, |
978 | 179 |
thumb_rect.width, thumb_rect.height) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
180 |
|
978 | 181 |
event.Skip() |
182 |
||
1749
d73b64672238
clean-up: fix PEP8 E305 expected 2 blank lines after class or function definition
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
183 |
|
1576
6df9937f130b
increase size for time buttons in LogViewer
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1571
diff
changeset
|
184 |
BUTTON_SIZE = (70, 15) |
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
185 |
|
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1735
diff
changeset
|
186 |
|
1831
56b48961cc68
fix (old-style-class) Old-style class defined error for most parts of
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1768
diff
changeset
|
187 |
class LogButton(object): |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
188 |
|
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
189 |
def __init__(self, label, callback): |
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
190 |
self.Position = wx.Point(0, 0) |
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
191 |
self.Size = wx.Size(*BUTTON_SIZE) |
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
192 |
self.Label = label |
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
193 |
self.Shown = True |
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
194 |
self.Callback = callback |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
195 |
|
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
196 |
def __del__(self): |
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
197 |
self.callback = None |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
198 |
|
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
199 |
def GetSize(self): |
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
200 |
return self.Size |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
201 |
|
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
202 |
def SetPosition(self, x, y): |
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
203 |
self.Position = wx.Point(x, y) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
204 |
|
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
205 |
def HitTest(self, x, y): |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
206 |
rect = wx.Rect(self.Position.x, self.Position.y, |
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
207 |
self.Size.width, self.Size.height) |
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2737
diff
changeset
|
208 |
if rect.Contains(x, y): |
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
209 |
return True |
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
210 |
return False |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
211 |
|
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
212 |
def ProcessCallback(self): |
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
213 |
if self.Callback is not None: |
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
214 |
wx.CallAfter(self.Callback) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
215 |
|
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
216 |
def Draw(self, dc): |
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
217 |
dc.SetPen(wx.TRANSPARENT_PEN) |
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
218 |
dc.SetBrush(wx.Brush(wx.NamedColour("LIGHT GREY"))) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
219 |
|
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
220 |
dc.DrawRectangle(self.Position.x, self.Position.y, |
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
221 |
self.Size.width, self.Size.height) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
222 |
|
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
223 |
w, h = dc.GetTextExtent(self.Label) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
224 |
dc.DrawText(self.Label, |
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2432
diff
changeset
|
225 |
self.Position.x + (self.Size.width - w) // 2, |
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2432
diff
changeset
|
226 |
self.Position.y + (self.Size.height - h) // 2) |
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
227 |
|
1749
d73b64672238
clean-up: fix PEP8 E305 expected 2 blank lines after class or function definition
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
228 |
|
978 | 229 |
DATE_INFO_SIZE = 10 |
997 | 230 |
MESSAGE_INFO_SIZE = 18 |
978 | 231 |
|
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1735
diff
changeset
|
232 |
|
1831
56b48961cc68
fix (old-style-class) Old-style class defined error for most parts of
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1768
diff
changeset
|
233 |
class LogMessage(object): |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
234 |
|
978 | 235 |
def __init__(self, tv_sec, tv_nsec, level, level_bitmap, msg): |
1076
2a02c6404124
Fixed bug in displayed datetime, using local timezone instead of UTC
Laurent Bessard
parents:
1071
diff
changeset
|
236 |
self.Date = datetime.utcfromtimestamp(tv_sec) |
978 | 237 |
self.Seconds = self.Date.second + tv_nsec * 1e-9 |
238 |
self.Date = self.Date.replace(second=0) |
|
982
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
239 |
self.Timestamp = tv_sec + tv_nsec * 1e-9 |
978 | 240 |
self.Level = level |
241 |
self.LevelBitmap = level_bitmap |
|
242 |
self.Message = msg |
|
243 |
self.DrawDate = True |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
244 |
|
978 | 245 |
def __cmp__(self, other): |
246 |
if self.Date == other.Date: |
|
247 |
return cmp(self.Seconds, other.Seconds) |
|
248 |
return cmp(self.Date, other.Date) |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
249 |
|
993 | 250 |
def GetFullText(self): |
251 |
date = self.Date.replace(second=int(self.Seconds)) |
|
252 |
nsec = (self.Seconds % 1.) * 1e9 |
|
253 |
return "%s at %s.%9.9d:\n%s" % ( |
|
254 |
LogLevels[self.Level], |
|
255 |
str(date), nsec, |
|
256 |
self.Message) |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
257 |
|
978 | 258 |
def Draw(self, dc, offset, width, draw_date): |
259 |
if draw_date: |
|
260 |
datetime_text = self.Date.strftime("%d/%m/%y %H:%M") |
|
261 |
dw, dh = dc.GetTextExtent(datetime_text) |
|
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2432
diff
changeset
|
262 |
dc.DrawText(datetime_text, (width - dw) // 2, offset + (DATE_INFO_SIZE - dh) // 2) |
978 | 263 |
offset += DATE_INFO_SIZE |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
264 |
|
978 | 265 |
seconds_text = "%12.9f" % self.Seconds |
266 |
sw, sh = dc.GetTextExtent(seconds_text) |
|
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2432
diff
changeset
|
267 |
dc.DrawText(seconds_text, 5, offset + (MESSAGE_INFO_SIZE - sh) // 2) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
268 |
|
978 | 269 |
bw, bh = self.LevelBitmap.GetWidth(), self.LevelBitmap.GetHeight() |
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2432
diff
changeset
|
270 |
dc.DrawBitmap(self.LevelBitmap, 10 + sw, offset + (MESSAGE_INFO_SIZE - bh) // 2) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
271 |
|
993 | 272 |
text = self.Message.replace("\n", " ") |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
273 |
_mw, mh = dc.GetTextExtent(text) |
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2432
diff
changeset
|
274 |
dc.DrawText(text, 15 + sw + bw, offset + (MESSAGE_INFO_SIZE - mh) // 2) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
275 |
|
978 | 276 |
def GetHeight(self, draw_date): |
277 |
if draw_date: |
|
278 |
return DATE_INFO_SIZE + MESSAGE_INFO_SIZE |
|
279 |
return MESSAGE_INFO_SIZE |
|
280 |
||
1749
d73b64672238
clean-up: fix PEP8 E305 expected 2 blank lines after class or function definition
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1745
diff
changeset
|
281 |
|
978 | 282 |
SECOND = 1 |
283 |
MINUTE = 60 * SECOND |
|
284 |
HOUR = 60 * MINUTE |
|
285 |
DAY = 24 * HOUR |
|
286 |
||
287 |
CHANGE_TIMESTAMP_BUTTONS = [(_("1d"), DAY), |
|
288 |
(_("1h"), HOUR), |
|
986 | 289 |
(_("1m"), MINUTE), |
290 |
(_("1s"), SECOND)] |
|
978 | 291 |
|
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1735
diff
changeset
|
292 |
|
978 | 293 |
class LogViewer(DebugViewer, wx.Panel): |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
294 |
|
978 | 295 |
def __init__(self, parent, window): |
1745
f9d32913bad4
clean-up: fix PEP8 E227 missing whitespace around bitwise or shift operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1742
diff
changeset
|
296 |
wx.Panel.__init__(self, parent, style=wx.TAB_TRAVERSAL | wx.SUNKEN_BORDER) |
978 | 297 |
DebugViewer.__init__(self, None, False, False) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
298 |
|
978 | 299 |
main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5) |
300 |
main_sizer.AddGrowableCol(0) |
|
301 |
main_sizer.AddGrowableRow(1) |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
302 |
|
978 | 303 |
filter_sizer = wx.BoxSizer(wx.HORIZONTAL) |
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2737
diff
changeset
|
304 |
main_sizer.Add(filter_sizer, border=5, flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.GROW) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
305 |
|
978 | 306 |
self.MessageFilter = wx.ComboBox(self, style=wx.CB_READONLY) |
307 |
self.MessageFilter.Append(_("All")) |
|
308 |
levels = LogLevels[:3] |
|
309 |
levels.reverse() |
|
310 |
for level in levels: |
|
311 |
self.MessageFilter.Append(_(level)) |
|
312 |
self.Bind(wx.EVT_COMBOBOX, self.OnMessageFilterChanged, self.MessageFilter) |
|
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2737
diff
changeset
|
313 |
filter_sizer.Add(self.MessageFilter, 1, border=5, flag=wx.RIGHT | wx.ALIGN_CENTER_VERTICAL) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
314 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
315 |
self.SearchMessage = wx.SearchCtrl(self, style=wx.TE_PROCESS_ENTER) |
978 | 316 |
self.SearchMessage.ShowSearchButton(True) |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
317 |
self.SearchMessage.ShowCancelButton(True) |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
318 |
self.Bind(wx.EVT_TEXT_ENTER, self.OnSearchMessageChanged, self.SearchMessage) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
319 |
self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1749
diff
changeset
|
320 |
self.OnSearchMessageSearchButtonClick, self.SearchMessage) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
321 |
self.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1749
diff
changeset
|
322 |
self.OnSearchMessageCancelButtonClick, self.SearchMessage) |
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2737
diff
changeset
|
323 |
filter_sizer.Add(self.SearchMessage, 3, border=5, flag=wx.RIGHT | wx.ALIGN_CENTER_VERTICAL) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
324 |
|
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
325 |
self.CleanButton = wx.lib.buttons.GenBitmapButton(self, bitmap=GetBitmap("Clean"), |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1749
diff
changeset
|
326 |
size=wx.Size(28, 28), style=wx.NO_BORDER) |
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2737
diff
changeset
|
327 |
self.CleanButton.SetToolTip(_("Clean log messages")) |
1093 | 328 |
self.Bind(wx.EVT_BUTTON, self.OnCleanButton, self.CleanButton) |
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2737
diff
changeset
|
329 |
filter_sizer.Add(self.CleanButton) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
330 |
|
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
331 |
message_panel_sizer = wx.FlexGridSizer(cols=2, hgap=0, rows=1, vgap=0) |
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
332 |
message_panel_sizer.AddGrowableCol(0) |
978 | 333 |
message_panel_sizer.AddGrowableRow(0) |
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2737
diff
changeset
|
334 |
main_sizer.Add(message_panel_sizer, border=5, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.GROW) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
335 |
|
978 | 336 |
self.MessagePanel = wx.Panel(self) |
337 |
if wx.Platform == '__WXMSW__': |
|
993 | 338 |
self.Font = wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL, faceName='Courier New') |
978 | 339 |
else: |
2704
4ba3bdc7d71f
Fix unmatched "Courier" font for monospace fonts on latest ubuntu 20.04. Selected "FreeMono" instead, present since at least 18.04
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2437
diff
changeset
|
340 |
self.Font = wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, faceName='FreeMono') |
984 | 341 |
self.MessagePanel.Bind(wx.EVT_LEFT_UP, self.OnMessagePanelLeftUp) |
993 | 342 |
self.MessagePanel.Bind(wx.EVT_RIGHT_UP, self.OnMessagePanelRightUp) |
986 | 343 |
self.MessagePanel.Bind(wx.EVT_LEFT_DCLICK, self.OnMessagePanelLeftDCLick) |
993 | 344 |
self.MessagePanel.Bind(wx.EVT_MOTION, self.OnMessagePanelMotion) |
345 |
self.MessagePanel.Bind(wx.EVT_LEAVE_WINDOW, self.OnMessagePanelLeaveWindow) |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
346 |
self.MessagePanel.Bind(wx.EVT_MOUSEWHEEL, self.OnMessagePanelMouseWheel) |
988
30e7571c10d0
Reduced flicker on LogViewer and DebugGraphPanel on Windows
Laurent Bessard
parents:
987
diff
changeset
|
347 |
self.MessagePanel.Bind(wx.EVT_ERASE_BACKGROUND, self.OnMessagePanelEraseBackground) |
978 | 348 |
self.MessagePanel.Bind(wx.EVT_PAINT, self.OnMessagePanelPaint) |
349 |
self.MessagePanel.Bind(wx.EVT_SIZE, self.OnMessagePanelResize) |
|
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2737
diff
changeset
|
350 |
message_panel_sizer.Add(self.MessagePanel, flag=wx.GROW) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
351 |
|
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
352 |
self.MessageScrollBar = LogScrollBar(self, wx.Size(16, -1)) |
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2737
diff
changeset
|
353 |
message_panel_sizer.Add(self.MessageScrollBar, flag=wx.GROW) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
354 |
|
978 | 355 |
self.SetSizer(main_sizer) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
356 |
|
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
357 |
self.LeftButtons = [] |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
358 |
for label, callback in [("+" + text, self.GenerateOnDurationButton(duration)) |
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
359 |
for text, duration in CHANGE_TIMESTAMP_BUTTONS]: |
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
360 |
self.LeftButtons.append(LogButton(label, callback)) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
361 |
|
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
362 |
self.RightButtons = [] |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
363 |
for label, callback in [("-" + text, self.GenerateOnDurationButton(-duration)) |
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
364 |
for text, duration in CHANGE_TIMESTAMP_BUTTONS]: |
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
365 |
self.RightButtons.append(LogButton(label, callback)) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
366 |
|
978 | 367 |
self.MessageFilter.SetSelection(0) |
368 |
self.LogSource = None |
|
369 |
self.ResetLogMessages() |
|
370 |
self.ParentWindow = window |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
371 |
|
979 | 372 |
self.LevelIcons = [GetBitmap("LOG_" + level) for level in LogLevels] |
978 | 373 |
self.LevelFilters = [range(i) for i in xrange(4, 0, -1)] |
374 |
self.CurrentFilter = self.LevelFilters[0] |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
375 |
self.CurrentSearchValue = "" |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
376 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
377 |
self.ScrollSpeed = 0. |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
378 |
self.LastStartTime = None |
978 | 379 |
self.ScrollTimer = wx.Timer(self, -1) |
380 |
self.Bind(wx.EVT_TIMER, self.OnScrollTimer, self.ScrollTimer) |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
381 |
|
993 | 382 |
self.LastMousePos = None |
383 |
self.MessageToolTip = None |
|
384 |
self.MessageToolTipTimer = wx.Timer(self, -1) |
|
385 |
self.Bind(wx.EVT_TIMER, self.OnMessageToolTipTimer, self.MessageToolTipTimer) |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
386 |
|
978 | 387 |
def __del__(self): |
388 |
self.ScrollTimer.Stop() |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
389 |
|
978 | 390 |
def ResetLogMessages(self): |
1672
9298ba0cd70a
reset loaded messages counts on new PLC program trasnfer
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1576
diff
changeset
|
391 |
self.ResetLogCounters() |
978 | 392 |
self.OldestMessages = [] |
393 |
self.LogMessages = [] |
|
982
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
394 |
self.LogMessagesTimestamp = numpy.array([]) |
978 | 395 |
self.CurrentMessage = None |
396 |
self.HasNewData = False |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
397 |
|
978 | 398 |
def SetLogSource(self, log_source): |
1989 | 399 |
self.LogSource = proxy(log_source) if log_source is not None else None |
1093 | 400 |
self.CleanButton.Enable(self.LogSource is not None) |
978 | 401 |
if log_source is not None: |
402 |
self.ResetLogMessages() |
|
1871
933fbe9a5e2c
fix problem happend when tests are running under python-coverage
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1847
diff
changeset
|
403 |
wx.CallAfter(self.RefreshView) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
404 |
|
978 | 405 |
def GetLogMessageFromSource(self, msgidx, level): |
406 |
if self.LogSource is not None: |
|
407 |
answer = self.LogSource.GetLogMessage(level, msgidx) |
|
408 |
if answer is not None: |
|
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
409 |
msg, _tick, tv_sec, tv_nsec = answer |
978 | 410 |
return LogMessage(tv_sec, tv_nsec, level, self.LevelIcons[level], msg) |
411 |
return None |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
412 |
|
1672
9298ba0cd70a
reset loaded messages counts on new PLC program trasnfer
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1576
diff
changeset
|
413 |
def ResetLogCounters(self): |
9298ba0cd70a
reset loaded messages counts on new PLC program trasnfer
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1576
diff
changeset
|
414 |
self.previous_log_count = [None]*LogLevelsCount |
1735
c02818d7e29f
clean-up: fix PEP8 W293 blank line contains whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1673
diff
changeset
|
415 |
|
978 | 416 |
def SetLogCounters(self, log_count): |
417 |
new_messages = [] |
|
418 |
for level, count, prev in zip(xrange(LogLevelsCount), log_count, self.previous_log_count): |
|
419 |
if count is not None and prev != count: |
|
420 |
if prev is None: |
|
1195
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
421 |
dump_end = max(-1, count - 10) |
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
422 |
oldest_message = (-1, None) |
978 | 423 |
else: |
424 |
dump_end = prev - 1 |
|
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1737
diff
changeset
|
425 |
for msgidx in xrange(count-1, dump_end, -1): |
978 | 426 |
new_message = self.GetLogMessageFromSource(msgidx, level) |
1093 | 427 |
if new_message is None: |
1195
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
428 |
if prev is None: |
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
429 |
oldest_message = (-1, None) |
1093 | 430 |
break |
431 |
if prev is None: |
|
1195
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
432 |
oldest_message = (msgidx, new_message) |
1093 | 433 |
if len(new_messages) == 0: |
434 |
new_messages = [new_message] |
|
978 | 435 |
else: |
436 |
new_messages.insert(0, new_message) |
|
1093 | 437 |
else: |
438 |
new_messages.insert(0, new_message) |
|
1079
6c8dfc4fc23b
Fixed bug in LogViewer when no Log Messages are available when first SetLogCounters
Laurent Bessard
parents:
1077
diff
changeset
|
439 |
if prev is None and len(self.OldestMessages) <= level: |
1195
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
440 |
self.OldestMessages.append(oldest_message) |
978 | 441 |
self.previous_log_count[level] = count |
442 |
new_messages.sort() |
|
443 |
if len(new_messages) > 0: |
|
444 |
self.HasNewData = True |
|
1071
5e740fe71fbe
Fixed bug in LogViewer when view is filtered and displaying last message and new messages appears
Laurent Bessard
parents:
1020
diff
changeset
|
445 |
if self.CurrentMessage is not None: |
5e740fe71fbe
Fixed bug in LogViewer when view is filtered and displaying last message and new messages appears
Laurent Bessard
parents:
1020
diff
changeset
|
446 |
current_is_last = self.GetNextMessage(self.CurrentMessage)[0] is None |
5e740fe71fbe
Fixed bug in LogViewer when view is filtered and displaying last message and new messages appears
Laurent Bessard
parents:
1020
diff
changeset
|
447 |
else: |
5e740fe71fbe
Fixed bug in LogViewer when view is filtered and displaying last message and new messages appears
Laurent Bessard
parents:
1020
diff
changeset
|
448 |
current_is_last = True |
978 | 449 |
for new_message in new_messages: |
450 |
self.LogMessages.append(new_message) |
|
982
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
451 |
self.LogMessagesTimestamp = numpy.append(self.LogMessagesTimestamp, [new_message.Timestamp]) |
1071
5e740fe71fbe
Fixed bug in LogViewer when view is filtered and displaying last message and new messages appears
Laurent Bessard
parents:
1020
diff
changeset
|
452 |
if current_is_last: |
5e740fe71fbe
Fixed bug in LogViewer when view is filtered and displaying last message and new messages appears
Laurent Bessard
parents:
1020
diff
changeset
|
453 |
self.ScrollToLast(False) |
993 | 454 |
self.ResetMessageToolTip() |
455 |
self.MessageToolTipTimer.Stop() |
|
999
cbab4c1635bd
Replaced LogConsole TextCtrl by StyledTextCtrl
Laurent Bessard
parents:
997
diff
changeset
|
456 |
self.ParentWindow.SelectTab(self) |
978 | 457 |
self.NewDataAvailable(None) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
458 |
|
982
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
459 |
def FilterLogMessage(self, message, timestamp=None): |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
460 |
return (message.Level in self.CurrentFilter and |
982
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
461 |
message.Message.find(self.CurrentSearchValue) != -1 and |
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
462 |
(timestamp is None or message.Timestamp < timestamp)) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
463 |
|
982
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
464 |
def GetMessageByTimestamp(self, timestamp): |
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
465 |
if self.CurrentMessage is not None: |
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
466 |
msgidx = numpy.argmin(abs(self.LogMessagesTimestamp - timestamp)) |
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
467 |
message = self.LogMessages[msgidx] |
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
468 |
if self.FilterLogMessage(message) and message.Timestamp > timestamp: |
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
469 |
return self.GetPreviousMessage(msgidx, timestamp) |
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
470 |
return message, msgidx |
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
471 |
return None, None |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
472 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
473 |
def GetNextMessage(self, msgidx): |
978 | 474 |
while msgidx < len(self.LogMessages) - 1: |
475 |
message = self.LogMessages[msgidx + 1] |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
476 |
if self.FilterLogMessage(message): |
978 | 477 |
return message, msgidx + 1 |
478 |
msgidx += 1 |
|
479 |
return None, None |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
480 |
|
982
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
481 |
def GetPreviousMessage(self, msgidx, timestamp=None): |
978 | 482 |
message = None |
483 |
while 0 < msgidx < len(self.LogMessages): |
|
484 |
message = self.LogMessages[msgidx - 1] |
|
982
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
485 |
if self.FilterLogMessage(message, timestamp): |
978 | 486 |
return message, msgidx - 1 |
487 |
msgidx -= 1 |
|
488 |
if len(self.LogMessages) > 0: |
|
489 |
message = self.LogMessages[0] |
|
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
490 |
for _idx, msg in self.OldestMessages: |
1195
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
491 |
if msg is not None and msg > message: |
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
492 |
message = msg |
978 | 493 |
while message is not None: |
494 |
level = message.Level |
|
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
495 |
oldest_msgidx, _oldest_message = self.OldestMessages[level] |
978 | 496 |
if oldest_msgidx > 0: |
1195
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
497 |
message = self.GetLogMessageFromSource(oldest_msgidx - 1, level) |
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
498 |
if message is not None: |
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
499 |
self.OldestMessages[level] = (oldest_msgidx - 1, message) |
978 | 500 |
else: |
501 |
self.OldestMessages[level] = (-1, None) |
|
502 |
else: |
|
1195
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
503 |
message = None |
978 | 504 |
self.OldestMessages[level] = (-1, None) |
1195
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
505 |
if message is not None: |
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
506 |
message_idx = 0 |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
507 |
while (message_idx < len(self.LogMessages) and |
1195
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
508 |
self.LogMessages[message_idx] < message): |
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
509 |
message_idx += 1 |
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
510 |
if len(self.LogMessages) > 0: |
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
511 |
current_message = self.LogMessages[self.CurrentMessage] |
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
512 |
else: |
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
513 |
current_message = message |
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
514 |
self.LogMessages.insert(message_idx, message) |
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
515 |
self.LogMessagesTimestamp = numpy.insert( |
1878
fb73a6b6622d
fix pylint warning '(bad-continuation) Wrong hanging indentation before block'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1871
diff
changeset
|
516 |
self.LogMessagesTimestamp, |
fb73a6b6622d
fix pylint warning '(bad-continuation) Wrong hanging indentation before block'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1871
diff
changeset
|
517 |
[message_idx], |
fb73a6b6622d
fix pylint warning '(bad-continuation) Wrong hanging indentation before block'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1871
diff
changeset
|
518 |
[message.Timestamp]) |
1195
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
519 |
self.CurrentMessage = self.LogMessages.index(current_message) |
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
520 |
if message_idx == 0 and self.FilterLogMessage(message, timestamp): |
8f8d9859e9fc
Fixed bug when collecting log messages from connector history for LogViewer
Laurent Bessard
parents:
1176
diff
changeset
|
521 |
return message, 0 |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
522 |
for _idx, msg in self.OldestMessages: |
978 | 523 |
if msg is not None and (message is None or msg > message): |
524 |
message = msg |
|
525 |
return None, None |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
526 |
|
978 | 527 |
def RefreshNewData(self, *args, **kwargs): |
528 |
if self.HasNewData: |
|
529 |
self.HasNewData = False |
|
530 |
self.RefreshView() |
|
531 |
DebugViewer.RefreshNewData(self, *args, **kwargs) |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
532 |
|
978 | 533 |
def RefreshView(self): |
534 |
width, height = self.MessagePanel.GetClientSize() |
|
3303
0ffb41625592
Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2737
diff
changeset
|
535 |
bitmap = wx.Bitmap(width, height) |
978 | 536 |
dc = wx.BufferedDC(wx.ClientDC(self.MessagePanel), bitmap) |
537 |
dc.Clear() |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
538 |
|
978 | 539 |
if self.CurrentMessage is not None: |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
540 |
|
993 | 541 |
dc.SetFont(self.Font) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
542 |
|
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
543 |
for button in self.LeftButtons + self.RightButtons: |
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
544 |
button.Draw(dc) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
545 |
|
978 | 546 |
message_idx = self.CurrentMessage |
547 |
message = self.LogMessages[message_idx] |
|
548 |
draw_date = True |
|
549 |
offset = 5 |
|
550 |
while offset < height and message is not None: |
|
551 |
message.Draw(dc, offset, width, draw_date) |
|
552 |
offset += message.GetHeight(draw_date) |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
553 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
554 |
previous_message, message_idx = self.GetPreviousMessage(message_idx) |
978 | 555 |
if previous_message is not None: |
556 |
draw_date = message.Date != previous_message.Date |
|
557 |
message = previous_message |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
558 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
559 |
self.MessageScrollBar.RefreshThumbPosition() |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
560 |
|
1673
fab1b8da6eba
clean PLC log only if there is something to clean
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1672
diff
changeset
|
561 |
def IsPLCLogEmpty(self): |
1742
92932cd370a4
clean-up: fix PEP8 E225 missing whitespace around operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1740
diff
changeset
|
562 |
empty = True |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
563 |
for _level, prev in zip(xrange(LogLevelsCount), self.previous_log_count): |
1673
fab1b8da6eba
clean PLC log only if there is something to clean
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1672
diff
changeset
|
564 |
if prev is not None: |
1742
92932cd370a4
clean-up: fix PEP8 E225 missing whitespace around operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1740
diff
changeset
|
565 |
empty = False |
1673
fab1b8da6eba
clean PLC log only if there is something to clean
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1672
diff
changeset
|
566 |
break |
fab1b8da6eba
clean PLC log only if there is something to clean
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1672
diff
changeset
|
567 |
return empty |
1735
c02818d7e29f
clean-up: fix PEP8 W293 blank line contains whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1673
diff
changeset
|
568 |
|
978 | 569 |
def IsMessagePanelTop(self, message_idx=None): |
570 |
if message_idx is None: |
|
571 |
message_idx = self.CurrentMessage |
|
572 |
if message_idx is not None: |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
573 |
return self.GetNextMessage(message_idx)[0] is None |
978 | 574 |
return True |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
575 |
|
978 | 576 |
def IsMessagePanelBottom(self, message_idx=None): |
577 |
if message_idx is None: |
|
578 |
message_idx = self.CurrentMessage |
|
579 |
if message_idx is not None: |
|
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
580 |
_width, height = self.MessagePanel.GetClientSize() |
978 | 581 |
offset = 5 |
582 |
message = self.LogMessages[message_idx] |
|
583 |
draw_date = True |
|
584 |
while message is not None and offset < height: |
|
585 |
offset += message.GetHeight(draw_date) |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
586 |
previous_message, message_idx = self.GetPreviousMessage(message_idx) |
978 | 587 |
if previous_message is not None: |
588 |
draw_date = message.Date != previous_message.Date |
|
589 |
message = previous_message |
|
590 |
return offset < height |
|
591 |
return True |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
592 |
|
978 | 593 |
def ScrollMessagePanel(self, scroll): |
594 |
if self.CurrentMessage is not None: |
|
595 |
message = self.LogMessages[self.CurrentMessage] |
|
596 |
while scroll > 0 and message is not None: |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
597 |
message, msgidx = self.GetNextMessage(self.CurrentMessage) |
978 | 598 |
if message is not None: |
599 |
self.CurrentMessage = msgidx |
|
600 |
scroll -= 1 |
|
601 |
while scroll < 0 and message is not None and not self.IsMessagePanelBottom(): |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
602 |
message, msgidx = self.GetPreviousMessage(self.CurrentMessage) |
978 | 603 |
if message is not None: |
604 |
self.CurrentMessage = msgidx |
|
605 |
scroll += 1 |
|
606 |
self.RefreshView() |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
607 |
|
986 | 608 |
def ScrollMessagePanelByPage(self, page): |
609 |
if self.CurrentMessage is not None: |
|
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
610 |
_width, height = self.MessagePanel.GetClientSize() |
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2432
diff
changeset
|
611 |
message_per_page = max(1, (height - DATE_INFO_SIZE) // MESSAGE_INFO_SIZE - 1) |
986 | 612 |
self.ScrollMessagePanel(page * message_per_page) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
613 |
|
982
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
614 |
def ScrollMessagePanelByTimestamp(self, seconds): |
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
615 |
if self.CurrentMessage is not None: |
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
616 |
current_message = self.LogMessages[self.CurrentMessage] |
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
617 |
message, msgidx = self.GetMessageByTimestamp(current_message.Timestamp + seconds) |
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
618 |
if message is None or self.IsMessagePanelBottom(msgidx): |
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
619 |
self.ScrollToFirst() |
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
620 |
else: |
1020
2d20f25cd39f
Fixed bug log viewer not scrolling when clicking on +1s and +1m when time between 2 message is greater than 1s or 1m
Laurent Bessard
parents:
999
diff
changeset
|
621 |
if seconds > 0 and self.CurrentMessage == msgidx and msgidx < len(self.LogMessages) - 1: |
2d20f25cd39f
Fixed bug log viewer not scrolling when clicking on +1s and +1m when time between 2 message is greater than 1s or 1m
Laurent Bessard
parents:
999
diff
changeset
|
622 |
msgidx += 1 |
982
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
623 |
self.CurrentMessage = msgidx |
984 | 624 |
self.RefreshView() |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
625 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
626 |
def ResetMessagePanel(self): |
978 | 627 |
if len(self.LogMessages) > 0: |
628 |
self.CurrentMessage = len(self.LogMessages) - 1 |
|
629 |
message = self.LogMessages[self.CurrentMessage] |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
630 |
while message is not None and not self.FilterLogMessage(message): |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
631 |
message, self.CurrentMessage = self.GetPreviousMessage(self.CurrentMessage) |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
632 |
self.RefreshView() |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
633 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
634 |
def OnMessageFilterChanged(self, event): |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
635 |
self.CurrentFilter = self.LevelFilters[self.MessageFilter.GetSelection()] |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
636 |
self.ResetMessagePanel() |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
637 |
event.Skip() |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
638 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
639 |
def OnSearchMessageChanged(self, event): |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
640 |
self.CurrentSearchValue = self.SearchMessage.GetValue() |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
641 |
self.ResetMessagePanel() |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
642 |
event.Skip() |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
643 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
644 |
def OnSearchMessageSearchButtonClick(self, event): |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
645 |
self.CurrentSearchValue = self.SearchMessage.GetValue() |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
646 |
self.ResetMessagePanel() |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
647 |
event.Skip() |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
648 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
649 |
def OnSearchMessageCancelButtonClick(self, event): |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
650 |
self.CurrentSearchValue = "" |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
651 |
self.SearchMessage.SetValue("") |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
652 |
self.ResetMessagePanel() |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
653 |
event.Skip() |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
654 |
|
1093 | 655 |
def OnCleanButton(self, event): |
1673
fab1b8da6eba
clean PLC log only if there is something to clean
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1672
diff
changeset
|
656 |
if self.LogSource is not None and not self.IsPLCLogEmpty(): |
1093 | 657 |
self.LogSource.ResetLogCount() |
658 |
self.ResetLogMessages() |
|
659 |
self.RefreshView() |
|
660 |
event.Skip() |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
661 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
662 |
def GenerateOnDurationButton(self, duration): |
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
663 |
def OnDurationButton(): |
982
e3c264099bd0
Added support in LogViewer for scrolling using relative timestamp
Laurent Bessard
parents:
981
diff
changeset
|
664 |
self.ScrollMessagePanelByTimestamp(duration) |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
665 |
return OnDurationButton |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
666 |
|
993 | 667 |
def GetCopyMessageToClipboardFunction(self, message): |
668 |
def CopyMessageToClipboardFunction(event): |
|
669 |
self.ParentWindow.SetCopyBuffer(message.GetFullText()) |
|
670 |
return CopyMessageToClipboardFunction |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
671 |
|
993 | 672 |
def GetMessageByScreenPos(self, posx, posy): |
983
7dd481eef3b5
Replaced left ugly buttons in LogViewer by custom buttons inside MessagePanel
Laurent Bessard
parents:
982
diff
changeset
|
673 |
if self.CurrentMessage is not None: |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
674 |
_width, height = self.MessagePanel.GetClientSize() |
986 | 675 |
message_idx = self.CurrentMessage |
676 |
message = self.LogMessages[message_idx] |
|
677 |
draw_date = True |
|
678 |
offset = 5 |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
679 |
|
986 | 680 |
while offset < height and message is not None: |
681 |
if draw_date: |
|
682 |
offset += DATE_INFO_SIZE |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
683 |
|
986 | 684 |
if offset <= posy < offset + MESSAGE_INFO_SIZE: |
993 | 685 |
return message |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
686 |
|
986 | 687 |
offset += MESSAGE_INFO_SIZE |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
688 |
|
986 | 689 |
previous_message, message_idx = self.GetPreviousMessage(message_idx) |
690 |
if previous_message is not None: |
|
691 |
draw_date = message.Date != previous_message.Date |
|
692 |
message = previous_message |
|
993 | 693 |
return None |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
694 |
|
993 | 695 |
def OnMessagePanelLeftUp(self, event): |
696 |
if self.CurrentMessage is not None: |
|
697 |
posx, posy = event.GetPosition() |
|
698 |
for button in self.LeftButtons + self.RightButtons: |
|
699 |
if button.HitTest(posx, posy): |
|
700 |
button.ProcessCallback() |
|
701 |
break |
|
702 |
event.Skip() |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
703 |
|
993 | 704 |
def OnMessagePanelRightUp(self, event): |
705 |
message = self.GetMessageByScreenPos(*event.GetPosition()) |
|
706 |
if message is not None: |
|
707 |
menu = wx.Menu(title='') |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
708 |
|
2737
38afed869ff6
Finished fixing Wx IDs abuse. There was still some wasted IDs because of wx.NewId calls in many places where it wasn't needed, and those IDs were not re-used. As a consequence Beremiz was making exception crashing after a few hours of intensive use.
Edouard Tisserant
parents:
2704
diff
changeset
|
709 |
menu_entry = menu.Append(help='', id=wx.ID_ANY, kind=wx.ITEM_NORMAL, text=_("Copy")) |
38afed869ff6
Finished fixing Wx IDs abuse. There was still some wasted IDs because of wx.NewId calls in many places where it wasn't needed, and those IDs were not re-used. As a consequence Beremiz was making exception crashing after a few hours of intensive use.
Edouard Tisserant
parents:
2704
diff
changeset
|
710 |
self.Bind(wx.EVT_MENU, self.GetCopyMessageToClipboardFunction(message), menu_entry) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
711 |
|
993 | 712 |
self.MessagePanel.PopupMenu(menu) |
713 |
menu.Destroy() |
|
714 |
event.Skip() |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
715 |
|
993 | 716 |
def OnMessagePanelLeftDCLick(self, event): |
717 |
message = self.GetMessageByScreenPos(*event.GetPosition()) |
|
718 |
if message is not None: |
|
719 |
self.SearchMessage.SetFocus() |
|
720 |
self.SearchMessage.SetValue(message.Message) |
|
721 |
event.Skip() |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
722 |
|
993 | 723 |
def ResetMessageToolTip(self): |
724 |
if self.MessageToolTip is not None: |
|
725 |
self.MessageToolTip.Destroy() |
|
726 |
self.MessageToolTip = None |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
727 |
|
993 | 728 |
def OnMessageToolTipTimer(self, event): |
729 |
if self.LastMousePos is not None: |
|
730 |
message = self.GetMessageByScreenPos(*self.LastMousePos) |
|
731 |
if message is not None: |
|
732 |
tooltip_pos = self.MessagePanel.ClientToScreen(self.LastMousePos) |
|
733 |
tooltip_pos.x += 10 |
|
734 |
tooltip_pos.y += 10 |
|
1169
53e4a2b775a7
Move CustomToolTip from GraphicCommons to controls
Laurent Bessard
parents:
1094
diff
changeset
|
735 |
self.MessageToolTip = CustomToolTip(self.MessagePanel, message.GetFullText(), False) |
993 | 736 |
self.MessageToolTip.SetFont(self.Font) |
1170
074e46cdedbc
Added support for displaying ToolTip, starting drag'n drop and Double click on Block connectors when debugging
Laurent Bessard
parents:
1169
diff
changeset
|
737 |
self.MessageToolTip.SetToolTipPosition(tooltip_pos) |
993 | 738 |
self.MessageToolTip.Show() |
739 |
event.Skip() |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
740 |
|
993 | 741 |
def OnMessagePanelMotion(self, event): |
742 |
if not event.Dragging(): |
|
743 |
self.ResetMessageToolTip() |
|
744 |
self.LastMousePos = event.GetPosition() |
|
745 |
self.MessageToolTipTimer.Start(int(TOOLTIP_WAIT_PERIOD * 1000), oneShot=True) |
|
746 |
event.Skip() |
|
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
747 |
|
993 | 748 |
def OnMessagePanelLeaveWindow(self, event): |
749 |
self.ResetMessageToolTip() |
|
750 |
self.LastMousePos = None |
|
751 |
self.MessageToolTipTimer.Stop() |
|
986 | 752 |
event.Skip() |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
753 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
754 |
def OnMessagePanelMouseWheel(self, event): |
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2432
diff
changeset
|
755 |
self.ScrollMessagePanel(event.GetWheelRotation() // event.GetWheelDelta()) |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
756 |
event.Skip() |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
757 |
|
988
30e7571c10d0
Reduced flicker on LogViewer and DebugGraphPanel on Windows
Laurent Bessard
parents:
987
diff
changeset
|
758 |
def OnMessagePanelEraseBackground(self, event): |
30e7571c10d0
Reduced flicker on LogViewer and DebugGraphPanel on Windows
Laurent Bessard
parents:
987
diff
changeset
|
759 |
pass |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
760 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
761 |
def OnMessagePanelPaint(self, event): |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
762 |
self.RefreshView() |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
763 |
event.Skip() |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
764 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
765 |
def OnMessagePanelResize(self, event): |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
766 |
width, _height = self.MessagePanel.GetClientSize() |
984 | 767 |
offset = 2 |
768 |
for button in self.LeftButtons: |
|
769 |
button.SetPosition(offset, 2) |
|
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
770 |
w, _h = button.GetSize() |
984 | 771 |
offset += w + 2 |
772 |
offset = width - 2 |
|
773 |
for button in self.RightButtons: |
|
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
774 |
w, _h = button.GetSize() |
984 | 775 |
button.SetPosition(offset - w, 2) |
776 |
offset -= w + 2 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
777 |
if self.IsMessagePanelBottom(): |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
778 |
self.ScrollToFirst() |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
779 |
else: |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
780 |
self.RefreshView() |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
781 |
event.Skip() |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
782 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
783 |
def OnScrollTimer(self, event): |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
784 |
if self.ScrollSpeed != 0.: |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
785 |
speed_norm = abs(self.ScrollSpeed) |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
786 |
period = REFRESH_PERIOD / speed_norm |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
787 |
self.ScrollMessagePanel(-speed_norm / self.ScrollSpeed) |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
788 |
self.LastStartTime = gettime() |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
789 |
self.ScrollTimer.Start(int(period * 1000), True) |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
790 |
event.Skip() |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
791 |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
792 |
def SetScrollSpeed(self, speed): |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
793 |
if speed == 0.: |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
794 |
self.ScrollTimer.Stop() |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
795 |
else: |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
796 |
speed_norm = abs(speed) |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
797 |
period = REFRESH_PERIOD / speed_norm |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
798 |
current_time = gettime() |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
799 |
if self.LastStartTime is not None: |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
800 |
elapsed_time = current_time - self.LastStartTime |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
801 |
if elapsed_time > period: |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
802 |
self.ScrollMessagePanel(-speed_norm / speed) |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
803 |
self.LastStartTime = current_time |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
804 |
else: |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
805 |
period -= elapsed_time |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
806 |
else: |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
807 |
self.LastStartTime = current_time |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
808 |
self.ScrollTimer.Start(int(period * 1000), True) |
1441
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
809 |
self.ScrollSpeed = speed |
826730e60407
Added auto-reconnect for runtime. Fixed Beremiz closing problem caused by remaining twisted reactor thread in IDE.
Edouard Tisserant
parents:
1195
diff
changeset
|
810 |
|
1071
5e740fe71fbe
Fixed bug in LogViewer when view is filtered and displaying last message and new messages appears
Laurent Bessard
parents:
1020
diff
changeset
|
811 |
def ScrollToLast(self, refresh=True): |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
812 |
if len(self.LogMessages) > 0: |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
813 |
self.CurrentMessage = len(self.LogMessages) - 1 |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
814 |
message = self.LogMessages[self.CurrentMessage] |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
815 |
if not self.FilterLogMessage(message): |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
816 |
message, self.CurrentMessage = self.GetPreviousMessage(self.CurrentMessage) |
1071
5e740fe71fbe
Fixed bug in LogViewer when view is filtered and displaying last message and new messages appears
Laurent Bessard
parents:
1020
diff
changeset
|
817 |
if refresh: |
5e740fe71fbe
Fixed bug in LogViewer when view is filtered and displaying last message and new messages appears
Laurent Bessard
parents:
1020
diff
changeset
|
818 |
self.RefreshView() |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
819 |
|
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
820 |
def ScrollToFirst(self): |
978 | 821 |
if len(self.LogMessages) > 0: |
822 |
message_idx = 0 |
|
823 |
message = self.LogMessages[message_idx] |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
824 |
if not self.FilterLogMessage(message): |
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
825 |
next_message, msgidx = self.GetNextMessage(message_idx) |
978 | 826 |
if next_message is not None: |
827 |
message_idx = msgidx |
|
828 |
message = next_message |
|
829 |
while message is not None: |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
830 |
message, msgidx = self.GetPreviousMessage(message_idx) |
978 | 831 |
if message is not None: |
832 |
message_idx = msgidx |
|
833 |
message = self.LogMessages[message_idx] |
|
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
834 |
if self.FilterLogMessage(message): |
978 | 835 |
while message is not None: |
981
fc671a3e95a9
Fixed LogViewer scrollbar and scroll methods
Laurent Bessard
parents:
979
diff
changeset
|
836 |
message, msgidx = self.GetNextMessage(message_idx) |
978 | 837 |
if message is not None: |
838 |
if not self.IsMessagePanelBottom(msgidx): |
|
839 |
break |
|
840 |
message_idx = msgidx |
|
841 |
self.CurrentMessage = message_idx |
|
842 |
else: |
|
843 |
self.CurrentMessage = None |
|
844 |
self.RefreshView() |