Merged marius_stanciu/flatcam_beta/Beta 8.992 into Beta

This commit is contained in:
Marius Stanciu 2020-04-29 22:14:02 +03:00
commit db8dd77c72
6 changed files with 48 additions and 26 deletions

View File

@ -23,6 +23,7 @@ CHANGELOG for FlatCAM beta
- updated the Romanian translation - updated the Romanian translation
- fixed units conversion issue - fixed units conversion issue
- updated the units conversion method to convert all the convertible parameters in the Preferences - updated the units conversion method to convert all the convertible parameters in the Preferences
- solved the problem with not closing all the tabs in Plot Area when creating a New Project; the issue was that once a tab was removed the indexes are remade (when tab 0 is removed then tab 1 becomes tab 0 and so on)
28.04.2020 28.04.2020

View File

@ -4586,7 +4586,7 @@ class App(QtCore.QObject):
self.ui.plot_tab_area.protectTab(0) self.ui.plot_tab_area.protectTab(0)
return return
if name != 'plotarea': if name != 'plotarea_tab':
self.ui.plot_tab_area.insertTab(0, self.ui.plot_tab, "Plot Area") self.ui.plot_tab_area.insertTab(0, self.ui.plot_tab, "Plot Area")
# remove the close button from the Plot Area tab (first tab index = 0) as this one will always be ON # remove the close button from the Plot Area tab (first tab index = 0) as this one will always be ON
self.ui.plot_tab_area.protectTab(0) self.ui.plot_tab_area.protectTab(0)
@ -6098,17 +6098,17 @@ class App(QtCore.QObject):
else: else:
return return
def on_plotarea_tab_closed(self, tab_idx): # def on_plotarea_tab_closed(self, tab_idx):
""" # """
#
:param tab_idx: Index of the Tab from the plotarea that was closed # :param tab_idx: Index of the Tab from the plotarea that was closed
:return: # :return:
""" # """
widget = self.ui.plot_tab_area.widget(tab_idx) # widget = self.ui.plot_tab_area.widget(tab_idx)
#
if widget is not None: # if widget is not None:
widget.deleteLater() # widget.deleteLater()
self.ui.plot_tab_area.removeTab(tab_idx) # self.ui.plot_tab_area.removeTab(tab_idx)
def on_flipy(self): def on_flipy(self):
""" """
@ -7368,6 +7368,7 @@ class App(QtCore.QObject):
# Remove everything from memory # Remove everything from memory
App.log.debug("on_file_new()") App.log.debug("on_file_new()")
# close any editor that might be open
if self.call_source != 'app': if self.call_source != 'app':
self.editor2object(cleanup=True) self.editor2object(cleanup=True)
# ## EDITOR section # ## EDITOR section
@ -7402,9 +7403,13 @@ class App(QtCore.QObject):
# tcl needs to be reinitialized, otherwise old shell variables etc remains # tcl needs to be reinitialized, otherwise old shell variables etc remains
self.shell.init_tcl() self.shell.init_tcl()
# delete any selection shape on canvas
self.delete_selection_shape() self.delete_selection_shape()
# delete all FlatCAM objects
self.collection.delete_all() self.collection.delete_all()
# add in Selected tab an initial text that describe the flow of work in FlatCAm
self.setup_component_editor() self.setup_component_editor()
# Clear project filename # Clear project filename
@ -7416,18 +7421,23 @@ class App(QtCore.QObject):
# Re-fresh project options # Re-fresh project options
self.on_options_app2project() self.on_options_app2project()
# Init Tools # Init FlatCAMTools
self.init_tools() self.init_tools()
# Try to close all tabs in the PlotArea but only if the GUI is active (CLI is None)
if cli is None: if cli is None:
# Close any Tabs opened in the Plot Tab Area section # we need to go in reverse because once we remove a tab then the index changes
for index in range(self.ui.plot_tab_area.count()): # meaning that removing the first tab (idx = 0) then the tab at former idx = 1 will assume idx = 0
self.ui.plot_tab_area.closeTab(index) # and so on. Therefore the deletion should be done in reverse
# for whatever reason previous command does not close the last tab so I do it manually wdg_count = self.ui.plot_tab_area.tabBar.count() - 1
self.ui.plot_tab_area.closeTab(0) for index in range(wdg_count, -1, -1):
try:
self.ui.plot_tab_area.closeTab(index)
except Exception as e:
log.debug("App.on_file_new() --> %s" % str(e))
# # And then add again the Plot Area # # And then add again the Plot Area
self.ui.plot_tab_area.addTab(self.ui.plot_tab, "Plot Area") self.ui.plot_tab_area.insertTab(0, self.ui.plot_tab, "Plot Area")
self.ui.plot_tab_area.protectTab(0) self.ui.plot_tab_area.protectTab(0)
# take the focus of the Notebook on Project Tab. # take the focus of the Notebook on Project Tab.

View File

@ -17,7 +17,7 @@ if '_' not in builtins.__dict__:
class BookmarkManager(QtWidgets.QWidget): class BookmarkManager(QtWidgets.QWidget):
mark_rows = QtCore.pyqtSignal() # mark_rows = QtCore.pyqtSignal()
def __init__(self, app, storage, parent=None): def __init__(self, app, storage, parent=None):
super(BookmarkManager, self).__init__(parent) super(BookmarkManager, self).__init__(parent)
@ -119,9 +119,18 @@ class BookmarkManager(QtWidgets.QWidget):
self.link_entry.returnPressed.connect(self.on_add_entry) self.link_entry.returnPressed.connect(self.on_add_entry)
# closebtn.clicked.connect(self.accept) # closebtn.clicked.connect(self.accept)
self.table_widget.drag_drop_sig.connect(self.mark_table_rows_for_actions) self.ui_connect()
self.build_bm_ui() self.build_bm_ui()
def ui_connect(self):
self.table_widget.drag_drop_sig.connect(self.mark_table_rows_for_actions)
def ui_disconnect(self):
try:
self.table_widget.drag_drop_sig.connect(self.mark_table_rows_for_actions)
except (TypeError, AttributeError):
pass
def build_bm_ui(self): def build_bm_ui(self):
self.table_widget.setRowCount(len(self.bm_dict)) self.table_widget.setRowCount(len(self.bm_dict))
@ -378,4 +387,5 @@ class BookmarkManager(QtWidgets.QWidget):
def closeEvent(self, QCloseEvent): def closeEvent(self, QCloseEvent):
self.rebuild_actions() self.rebuild_actions()
self.ui_disconnect()
super().closeEvent(QCloseEvent) super().closeEvent(QCloseEvent)

View File

@ -1169,7 +1169,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.plot_tab_area.setTabsClosable(True) self.plot_tab_area.setTabsClosable(True)
self.plot_tab = QtWidgets.QWidget() self.plot_tab = QtWidgets.QWidget()
self.plot_tab.setObjectName("plotarea") self.plot_tab.setObjectName("plotarea_tab")
self.plot_tab_area.addTab(self.plot_tab, _("Plot Area")) self.plot_tab_area.addTab(self.plot_tab, _("Plot Area"))
self.right_layout = QtWidgets.QVBoxLayout() self.right_layout = QtWidgets.QVBoxLayout()

View File

@ -2076,7 +2076,7 @@ class FCDetachableTab(QtWidgets.QTabWidget):
class FCDetachableTab2(FCDetachableTab): class FCDetachableTab2(FCDetachableTab):
tab_closed_signal = QtCore.pyqtSignal(object) tab_closed_signal = QtCore.pyqtSignal(object, int)
def __init__(self, protect=None, protect_by_name=None, parent=None): def __init__(self, protect=None, protect_by_name=None, parent=None):
super(FCDetachableTab2, self).__init__(protect=protect, protect_by_name=protect_by_name, parent=parent) super(FCDetachableTab2, self).__init__(protect=protect, protect_by_name=protect_by_name, parent=parent)
@ -2089,8 +2089,8 @@ class FCDetachableTab2(FCDetachableTab):
:return: :return:
""" """
# idx = self.currentIndex() # idx = self.currentIndex()
self.tab_name = self.widget(currentIndex).objectName() tab_name = self.widget(currentIndex).objectName()
self.tab_closed_signal.emit(self.tab_name) self.tab_closed_signal.emit(tab_name, currentIndex)
self.removeTab(currentIndex) self.removeTab(currentIndex)

View File

@ -464,11 +464,11 @@ class CutOut(FlatCAMTool):
self.type_obj_radio.set_value('grb') self.type_obj_radio.set_value('grb')
def on_freeform_cutout(self): def on_freeform_cutout(self):
log.debug("Cutout.on_freeform_cutout() was launched ...")
# def subtract_rectangle(obj_, x0, y0, x1, y1): # def subtract_rectangle(obj_, x0, y0, x1, y1):
# pts = [(x0, y0), (x1, y0), (x1, y1), (x0, y1)] # pts = [(x0, y0), (x1, y0), (x1, y1), (x0, y1)]
# obj_.subtract_polygon(pts) # obj_.subtract_polygon(pts)
name = self.obj_combo.currentText() name = self.obj_combo.currentText()
# Get source object. # Get source object.
@ -651,6 +651,7 @@ class CutOut(FlatCAMTool):
self.app.should_we_save = True self.app.should_we_save = True
def on_rectangular_cutout(self): def on_rectangular_cutout(self):
log.debug("Cutout.on_rectangular_cutout() was launched ...")
# def subtract_rectangle(obj_, x0, y0, x1, y1): # def subtract_rectangle(obj_, x0, y0, x1, y1):
# pts = [(x0, y0), (x1, y0), (x1, y1), (x0, y1)] # pts = [(x0, y0), (x1, y0), (x1, y1), (x0, y1)]