Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GUI for logging - cutelog
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
Third Party
GUI for logging - cutelog
Commits
8a7fd74a
Commit
8a7fd74a
authored
4 years ago
by
Luca Erbetta
Browse files
Options
Downloads
Patches
Plain Diff
Open serial port on startup & display it in a tab
parent
5e813526
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
cutelog/__main__.py
+16
-2
16 additions, 2 deletions
cutelog/__main__.py
serialtest.py
+8
-0
8 additions, 0 deletions
serialtest.py
with
24 additions
and
2 deletions
cutelog/__main__.py
+
16
−
2
View file @
8a7fd74a
import
sys
import
sys
import
argparse
import
qtpy
import
qtpy
if
not
qtpy
.
PYQT5
and
not
qtpy
.
PYSIDE2
:
if
not
qtpy
.
PYQT5
and
not
qtpy
.
PYSIDE2
:
if
sys
.
platform
==
'
linux
'
:
if
sys
.
platform
==
'
linux
'
:
sys
.
exit
(
"
Error: a compatible Qt library couldn
'
t be imported.
\n
"
sys
.
exit
(
"
Error: a compatible Qt library couldn
'
t be imported.
\n
"
...
@@ -14,8 +13,10 @@ if not qtpy.PYQT5 and not qtpy.PYSIDE2:
...
@@ -14,8 +13,10 @@ if not qtpy.PYQT5 and not qtpy.PYSIDE2:
def
main
():
def
main
():
import
signal
import
signal
import
serial
from
.config
import
ROOT_LOG
from
.config
import
ROOT_LOG
from
.main_window
import
MainWindow
from
.main_window
import
MainWindow
from
.serial
import
SerialConnection
from
.resources
import
qCleanupResources
from
.resources
import
qCleanupResources
from
qtpy.QtGui
import
QIcon
from
qtpy.QtGui
import
QIcon
from
qtpy.QtWidgets
import
QApplication
from
qtpy.QtWidgets
import
QApplication
...
@@ -25,6 +26,19 @@ def main():
...
@@ -25,6 +26,19 @@ def main():
appid
=
'
busimus.cutelog
'
appid
=
'
busimus.cutelog
'
ctypes
.
windll
.
shell32
.
SetCurrentProcessExplicitAppUserModelID
(
appid
)
ctypes
.
windll
.
shell32
.
SetCurrentProcessExplicitAppUserModelID
(
appid
)
parser
=
argparse
.
ArgumentParser
(
description
=
'
Open a serial port and neatly display log messages
'
)
parser
.
add_argument
(
'
port
'
,
metavar
=
'
Serial port
'
,
type
=
str
,
nargs
=
1
,
help
=
'
Serial port to open
'
)
parser
.
add_argument
(
'
baud
'
,
metavar
=
'
Baud Rate
'
,
type
=
int
,
nargs
=
1
,
help
=
'
baud rate
'
)
args
=
parser
.
parse_args
()
try
:
ser
=
SerialConnection
(
None
,
args
.
port
[
0
],
args
.
baud
[
0
])
except
serial
.
serialutil
.
SerialException
as
err
:
sys
.
exit
(
"
Error opening serial port: {}
"
.
format
(
str
(
err
)))
app
=
QApplication
(
sys
.
argv
)
app
=
QApplication
(
sys
.
argv
)
app
.
setWindowIcon
(
QIcon
(
'
:/cutelog.png
'
))
app
.
setWindowIcon
(
QIcon
(
'
:/cutelog.png
'
))
mw
=
MainWindow
(
ROOT_LOG
,
app
)
mw
=
MainWindow
(
ROOT_LOG
,
app
)
...
...
This diff is collapsed.
Click to expand it.
serialtest.py
0 → 100644
+
8
−
0
View file @
8a7fd74a
import
serial
ser
=
serial
.
Serial
(
'
COM6
'
,
19200
,
timeout
=
5
)
for
i
in
range
(
1
,
10
):
s
=
ser
.
readline
().
decode
(
"
utf-8
"
).
strip
(
"
\n\r
"
)
print
(
s
)
#ser.close()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment