- in CNCJob UI Autolevelling - Grbl Connect tab colors will change with the connection status

This commit is contained in:
Marius Stanciu 2020-08-19 04:36:46 +03:00
parent 33c633f0c4
commit 7285ee0b82
3 changed files with 14 additions and 3 deletions

View File

@ -10,6 +10,7 @@ CHANGELOG for FlatCAM beta
19.08.2020
- in CNCJob UI Autolevelling - sending GCode/GRBL commands is now threaded
- in CNCJob UI Autolevelling - Grbl Connect tab colors will change with the connection status
18.08.2020

View File

@ -2084,6 +2084,10 @@ class CNCObjectUI(ObjectUI):
# self.gr_conn_tab_layout.addWidget(self.gr_conn_scroll_area)
self.al_toolbar.addTab(self.gr_conn_tab, _("Connect"))
for idx in range(self.al_toolbar.count()):
if self.al_toolbar.tabText(idx) == _("Connect"):
self.al_toolbar.tabBar.setTabTextColor(idx, QtGui.QColor('red'))
# GRBL Control TAB
self.gr_ctrl_tab = QtWidgets.QWidget()
self.gr_ctrl_tab.setObjectName("connect_tab")
@ -2176,6 +2180,7 @@ class CNCObjectUI(ObjectUI):
self.com_connect_button.setToolTip(
_("Connect to the selected port with the selected baud rate.")
)
self.com_connect_button.setStyleSheet("QPushButton {background-color: red;}")
ctrl_hlay.addWidget(self.com_connect_button)
grbl_conn_grid.addLayout(ctrl_hlay, 10, 0, 1, 3)

View File

@ -953,8 +953,10 @@ class CNCJobObject(FlatCAMObj, CNCjob):
rtscts=False)
self.app.inform.emit("%s: %s" % (_("Port connected"), port_name))
self.ui.com_connect_button.setStyleSheet("QPushButton {color: seagreen;}")
self.ui.com_connect_button.setStyleSheet("QPushButton {background-color: seagreen;}")
for idx in range(self.ui.al_toolbar.count()):
if self.ui.al_toolbar.tabText(idx) == _("Connect"):
self.ui.al_toolbar.tabBar.setTabTextColor(idx, QtGui.QColor('seagreen'))
# Toggle DTR to reset the controller loaded with GRBL (Arduino, ESP32, etc)
try:
self.grbl_ser_port.dtr = False
@ -971,7 +973,10 @@ class CNCJobObject(FlatCAMObj, CNCjob):
self.grbl_ser_port = serial.Serial()
self.grbl_ser_port.port = port_name
self.grbl_ser_port.close()
self.ui.com_connect_button.setStyleSheet("")
self.ui.com_connect_button.setStyleSheet("QPushButton {background-color: red;}")
for idx in range(self.ui.al_toolbar.count()):
if self.ui.al_toolbar.tabText(idx) == _("Connect"):
self.ui.al_toolbar.tabBar.setTabTextColor(idx, QtGui.QColor('red'))
self.app.inform.emit("%s: %s" % (_("Port is connected. Disconnecting"), port_name))
except Exception:
self.app.inform.emit("[ERROR_NOTCL] %s: %s" % (_("Could not connect to port"), port_name))