def on_delete_module_clicked(self):
        """
        Check to see if the last item is enabled
        If it is, delete the last item in the list
        And then call the del_layout function, which will remove the item from the UI

        :return:
        """
        try:
            if self.widgetList[-1].isEnabled():
                del self.widgetList[-1]
                delete.del_layout(self.verticalLayout_3)
            else:
                print("Cannot delete")
        except:
            print("Cannot delete")
예제 #2
0
    def delete_module(self, _idx=1):
        """
        Check to see if the last item is enabled
        If it is, delete the last item in the list
        And then call the del_layout function, which will remove the item from the UI

        :return:
        """

        def idx(total, position):
            return total - position + 1

        try:
            if self.widgetList[_idx - 1].isEnabled():
                self.widgetList[_idx - 1].delete()  # Call internal module's delete method
                del self.widgetList[_idx - 1]  # remove the widget from the list
                delete.del_layout(self.verticalLayout_2, idx(self.verticalLayout_2.count(), _idx))  # delete the layout
            else:
                print("Cannot delete")
        except Exception as e:
            print("Cannot delete: ", e)