- in Legacy(2D) graphic engine made to work the mouse color change

- theme changing is no longer auto-reboot upon change; it require now to press a button
This commit is contained in:
Marius Stanciu
2019-12-26 14:38:23 +02:00
committed by Marius
parent f0ed74ce5f
commit 787d85391a
4 changed files with 36 additions and 23 deletions

View File

@@ -407,8 +407,10 @@ class PlotCanvasLegacy(QtCore.QObject):
:param x_pos: mouse x position
:param y_pos: mouse y position
:param color: custom color of the mouse
:return:
"""
# there is no point in drawing mouse cursor when panning as it jumps in a confusing way
if self.app.app_cursor.enabled is True and self.panning is False:
if color:
@@ -446,7 +448,10 @@ class PlotCanvasLegacy(QtCore.QObject):
def clear_cursor(self, state):
if state is True:
self.draw_cursor(x_pos=self.mouse[0], y_pos=self.mouse[1])
if self.app.defaults["global_cursor_color_enabled"] is True:
self.draw_cursor(x_pos=self.mouse[0], y_pos=self.mouse[1], color=self.app.cursor_color_3D)
else:
self.draw_cursor(x_pos=self.mouse[0], y_pos=self.mouse[1])
else:
if self.big_cursor is True:
self.ch_line.remove()
@@ -791,7 +796,10 @@ class PlotCanvasLegacy(QtCore.QObject):
self.panning = False
# And update the cursor
self.draw_cursor(x_pos=self.mouse[0], y_pos=self.mouse[1])
if self.app.defaults["global_cursor_color_enabled"] is True:
self.draw_cursor(x_pos=self.mouse[0], y_pos=self.mouse[1], color=self.app.cursor_color_3D)
else:
self.draw_cursor(x_pos=self.mouse[0], y_pos=self.mouse[1])
def on_mouse_move(self, event):
"""
@@ -825,8 +833,10 @@ class PlotCanvasLegacy(QtCore.QObject):
# #### Temporary place-holder for cached update #####
self.update_screen_request.emit([0, 0, 0, 0, 0])
self.draw_cursor(x_pos=x, y_pos=y)
if self.app.defaults["global_cursor_color_enabled"] is True:
self.draw_cursor(x_pos=x, y_pos=y, color=self.app.cursor_color_3D)
else:
self.draw_cursor(x_pos=x, y_pos=y)
# self.canvas.blit(self.axes.bbox)
def translate_coords(self, position):
@@ -898,6 +908,7 @@ class FakeCursor(QtCore.QObject):
def set_data(self, pos, **kwargs):
"""Internal event handler to draw the cursor when the mouse moves."""
return
class ShapeCollectionLegacy:

View File

@@ -676,7 +676,17 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
self.layout.addStretch()
self.theme_button.clicked.connect(self.app.on_theme_change)
self.theme_button.clicked.connect(self.on_theme_change)
def on_theme_change(self):
val = self.theme_radio.get_value()
t_settings = QSettings("Open Source", "FlatCAM")
t_settings.setValue('theme', val)
# This will write the setting to the platform specific storage.
del t_settings
self.app.on_app_restart()
def handle_style(self, style):
# set current style